libb.cachedstaticproperty
- class cachedstaticproperty(func)[source]
Bases:
objectDecorator combining @property and @staticmethod with caching.
Creates a class-level property that is computed once on first access and cached for subsequent accesses.
Basic Usage (expensive computation runs only once):
>>> def somecalc(): ... print('Running somecalc...') ... return 1 >>> class Foo: ... @cachedstaticproperty ... def somefunc(): ... return somecalc() >>> Foo.somefunc Running somecalc... 1 >>> Foo.somefunc 1