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.

Methods

__init__(func[, name, doc])
deleter Descriptor to change the deleter on a property.
getter Descriptor to change the getter on a property.
setter Descriptor to change the setter on a property.

Attributes

fdel
fget
fset