werkzeug.cached_property
¶
-
class
werkzeug.
cached_property
(func, name=None, doc=None)[source]¶ A decorator that converts a function into a lazy property. The function wrapped is called the first time to retrieve the result and then that calculated result is used the next time you access the value:
class Foo(object): @cached_property def foo(self): # calculate something important here return 42
The class has to have a __dict__ in order for this property to work.