class cached_property(property, t.Generic[_T]):
A property
that is only evaluated once. Subsequent access
returns the cached value. Setting the property sets the cached
value. Deleting the property clears the cached value, accessing it
again will evaluate it again.
class Example: @cached_property def value(self): # calculate something important here return 42 e = Example() e.value # evaluates e.value # uses cache e.value = 16 # sets cache del e.value # clears cache
The class must have a __dict__ for this to work.
Method | __delete__ |
Undocumented |
Method | __get__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __set__ |
Undocumented |
Instance Variable | __module__ |
Undocumented |
Instance Variable | __name__ |
Undocumented |