lazy 1.2 – Lazy Attributes

The lazy module provides a decorator to create lazy attributes. A lazy attribute is a computed attribute that is evaluated only once, the first time it is used. Subsequent uses return the results of the first call.

API Documentation

class lazy.lazy(func)

lazy descriptor.

Used as a decorator to create lazy attributes. Lazy attributes are evaluated on first use.

classmethod lazy.invalidate(inst, name)

Invalidate a lazy attribute.

This obviously violates the lazy contract. Subclasses of lazy may however have a contract where invalidation is appropriate.

Indices and Tables

Table Of Contents