| Home | Trees | Indices | Help |
|---|
|
|
object --+
|
lazy_attribute
Decorator that will turn a method in a lazy attribute. The first time the attribute is accessed its value will be computed using the decorated method and then cached.
Example:
class MyClass(object):
@lazy_attribute
def my_attribute(self):
print "Computing"
return 0
obj = MyClass()
print obj.my_attribute
print obj.my_attribute
Output:
Computing 0 0
|
|||
|
|||
|
|||
|
Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
x.__init__(...) initializes x; see help(type(x)) for signature
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Wed Mar 6 18:53:32 2013 | http://epydoc.sourceforge.net |