Implementing class attribute access methods via pseudo-functi on o verloading.
__peter__ at web.de
Mon Oct 25 14:28:09 CEST 2004
Doran_Dermot at emc.com wrote:
> Maybe I should change that to read "I prefer:" and "However, the second
> version feels more natural to myself" ;-)
Note that properties don't interfere with your favourite accessor method
>>> class T(object):
... def title(self, value=None):
... if value is None:
... print "reading title"
... print "setting title to", value
... title = property(title, title)
>>> T().title = "new title"
setting title to new title
More information about the Python-list