On Nov 10, 2007 11:09 AM, Steven Bethard
On Nov 10, 2007 11:31 AM, Guido van Rossum
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?
Which is sometimes convenient. But thinking about this some more I think that if I *wanted* to use the same method as setter and deleter, I could just write @foo.setter @foo.deleter def foo(self, value=None): ... So I'm withdrawing the hacks, making the code and semantics much simpler. See propset3.diff in http://bugs.python.org/issue1416 . -- --Guido van Rossum (home page: http://www.python.org/~guido/)