Decorator to create OneTimeProperty attributes.
Parameters: | func : method
|
---|
Examples
>>> class MagicProp(object):
... @setattr_on_read
... def a(self):
... return 99
...
>>> x = MagicProp()
>>> 'a' in x.__dict__
False
>>> x.a
99
>>> 'a' in x.__dict__
True