Re: [Python-Dev] Cached Property Pattern

2006-12-29 Thread Fred L. Drake, Jr.
On Friday 29 December 2006 10:50, Oleg Broytmann wrote: >I don't remember any resolution. I think submitting a small module to > the patch tracker would be the simplest way to revive the discussion. We have a handful of interesting descriptors we use for Zope 3 development: http://svn.z

Re: [Python-Dev] Cached Property Pattern

2006-12-29 Thread Oleg Broytmann
On Fri, Dec 29, 2006 at 09:55:46AM -0500, Calvin Spealman wrote: > It may have been discussed before, but there does not seem to have > been any resolution on the issue. Am I missing something or did the > discussion just kind of stop, with no solution or agreement ever > reached? In which case, re

Re: [Python-Dev] Cached Property Pattern

2006-12-29 Thread Calvin Spealman
It may have been discussed before, but there does not seem to have been any resolution on the issue. Am I missing something or did the discussion just kind of stop, with no solution or agreement ever reached? In which case, reviving the question is not a bad idea, is it? On 12/29/06, Oleg Broytman

Re: [Python-Dev] Cached Property Pattern

2006-12-29 Thread Oleg Broytmann
http://mail.python.org/pipermail/python-dev/2005-September/056782.html On Fri, Dec 29, 2006 at 02:40:05AM -0500, Calvin Spealman wrote: > To this end, should a cachedproperty builtin be included to do this The issue was discussed a year ago: http://mail.python.org/pipermail/python-dev/2005-Se

[Python-Dev] Cached Property Pattern

2006-12-28 Thread Calvin Spealman
A very common pattern in using properties is as follows: class Foo(object): @property def c(self): if not hasattr(self, '_c'): self._c = some_operation(self.a, self.b) return self._c Basically, the common usage is to only calculate a properties value once, and