[Python-Dev] Declaring setters with getters
Steven Bethard
steven.bethard at gmail.com
Sat Nov 10 20:09:16 CET 2007
On Nov 10, 2007 11:31 AM, Guido van Rossum <guido at python.org> wrote:
> Unless I get negative feedback really soon I plan to submit this later
> today. I've tweaked the patch slightly to be smarter about replacing
> the setter and the deleter together if they are the same object.
Definitely +1 on the basic patch.
Could you explain briefly the advantage of the "hack" that merges the
set and del methods? Looking at the patch, I get a little nervous
about this::
@foo.setter
def foo(self, value=None):
if value is None:
del self._foo
else:
self._foo = abs(value)
That means that ``c.foo = None`` is equivalent to ``del c.foo`` right?
STeVe
--
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
--- Bucky Katt, Get Fuzzy
More information about the Python-Dev
mailing list