[Python-Dev] Declaring setters with getters
Guido van Rossum
guido at python.org
Wed Oct 31 21:28:37 CET 2007
On 10/31/07, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 11:09 AM 10/31/2007 -0700, Guido van Rossum wrote:
> >Yes, though I think that if prop.fdel is None, we could use func in
> >both slots.
> Eh? Isn't prop.fdel supposed to be a single-argument function? ISTM
> that C is the only place where fset and fdel are the same thing.
Given how rarely supporting deletions matters enough to write extra
code, we can just say that *when using @propset* your setter function
needs to have a default value for the argument or otherwise support
being called with one or two arguments.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev