ranger
.
ext
.lazy_property
index
../../ranger/ext/lazy_property.py
# From
http://blog.pythonisito.com/2008/08/lazy-descriptors.html
Classes
builtins.object
lazy_property
class
lazy_property
(
builtins.object
)
A @property-like decorator with lazy evaluation
>>> class Foo:
... @
lazy_property
... def answer(self):
... print("calculating answer...")
... return 2*3*7
>>> foo = Foo()
>>> foo.answer
calculating answer...
42
>>> foo.answer
42
Methods defined here:
__get__
(self, obj, cls=None)
__init__
(self, method)
Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)