31 Jan
2003
31 Jan
'03
1:31 a.m.
holger krekel
IMO none of the new syntax ideas really have much appeal.
I have the same feeling.
One way to define lightweight properties today is something like
foo = property( lambda s: s.__dict__.get('_foo_', 42), lambda s,x: s.__dict__.__setitem__('_foo_', x), lambda s: s.__dict__.__delitem__('_foo_'), "foo property" )
and this is something I actually have done, for readonly computed properties (without docstring), where this is reduced to foo = property(lambda self: self._bar) All in all, I'm not so unhappy with the current way. Thomas