From f9bae845eabd975a07e24d94e399299c1601acb7 Mon Sep 17 00:00:00 2001 From: Adam Alton Date: Mon, 15 May 2017 14:05:42 +0100 Subject: [PATCH] Added a docstring to cached_property.__get__(). --- django/utils/functional.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/django/utils/functional.py b/django/utils/functional.py index 92be506f3b7..93c1cc1984d 100644 --- a/django/utils/functional.py +++ b/django/utils/functional.py @@ -26,6 +26,10 @@ class cached_property: self.name = name or func.__name__ def __get__(self, instance, cls=None): + """ + Call the function and replace this cached_property instance with the + return value so that the function and this method aren't called again. + """ if instance is None: return self res = instance.__dict__[self.name] = self.func(instance)