
I think it would be nice to add a "cache" argument to the property() constructor. When "cache" was True, property would only ask the getter function once for the result. This would simplify properties that require expensive operations to compute.
-1 on an extra parameter to property.
+1 on a cache decorator.
It is clear and simple enough to write something like:
@property @cache # or "once" if you prefer the Eiffel name def value(self): pass
Such a decorator could then be used on any appropriate function, not just for properties.
I agree, -1 on modifying @property and +1 on adding a new decorator to functools or some other module, maybe a collection of useful decorators. Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown