Implementing class attribute access methods via pseudo-function o verloading.
Michael Hoffman
m.h.3.9.1.without.dots.at.cam.ac.uk at example.com
Mon Oct 25 07:43:54 EDT 2004
Daniel Dittmar wrote:
> Doran_Dermot at emc.com wrote:
>
>> def title( self, title=None ):
>> if title == None:
>> return self._title
>> self._title = title
>
> You probably meant
> def title( self, title=None ):
> if title == None:
> return self._title
> else:
> self._title = title
>
> or every read access would clear the attribute.
No, the OP was right here--the return occurs before the attribute can be
set.
--
Michael Hoffman
More information about the Python-list
mailing list