[Python-Dev] RFC: readproperty
barry at python.org
Thu Sep 29 00:23:15 CEST 2005
On Wed, 2005-09-28 at 10:16, Jim Fulton wrote:
> When we ask for the eggs attribute the first time, we call the
> descriptor, which calls the eggs function. The function sets the eggs
> attribute, overriding the descriptor. The next time the eggs attribute
> is accessed, the saved value will be used without calling the
> I do this often enough that I think it would be useful to include it
> in python, either as a builtin (like property) or in the library. (Or
> possibly by adding an option to property to generate a read
> descriptor.) I'd be happy to add this for 2.5.
I /must/ be missing something. Why not just use property as a
print 'in eggs'
self.eggs = 7
>>> c = C()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20050928/ae8fa9bc/attachment.pgp
More information about the Python-Dev