mirror of
https://github.com/django/django.git
synced 2025-03-06 15:32:33 +00:00
Added a docstring to cached_property.__get__().
This commit is contained in:
parent
3a5299c19c
commit
f9bae845ea
@ -26,6 +26,10 @@ class cached_property:
|
|||||||
self.name = name or func.__name__
|
self.name = name or func.__name__
|
||||||
|
|
||||||
def __get__(self, instance, cls=None):
|
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:
|
if instance is None:
|
||||||
return self
|
return self
|
||||||
res = instance.__dict__[self.name] = self.func(instance)
|
res = instance.__dict__[self.name] = self.func(instance)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user