cached_property
Decorator that converts a method with a single self argument into a property cached on the instance.
Attributes
| Attribute | Type | Description |
|---|---|---|
| name | string = None | The name of the attribute as it appears on the owner class, used to store the computed value in the instance's dictionary. |
Constructor
Signature
def cached_property(
func: callable
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| func | callable | The method to be converted into a cached property. |
Methods
func()
@classmethod
def func(
instance: object
) - > null
Raises a TypeError to prevent usage of the cached_property before it has been properly initialized via set_name.
Parameters
| Name | Type | Description |
|---|---|---|
| instance | object | The class instance the property is being accessed on |
Returns
| Type | Description |
|---|---|
null |