[Python-ideas] caching properties
Oleg Broytmann
phd at phd.pp.ru
Thu Apr 30 01:06:20 CEST 2009
On Wed, Apr 29, 2009 at 10:33:27PM +0000, Benjamin Peterson wrote:
> 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.
http://ppa.cvs.sourceforge.net/viewvc/*checkout*/ppa/QPS/qps/qUtils.py
See class CachedAttribute. Just use @CachedAttribute instead of
@property.
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-ideas
mailing list