[Python-Dev] Definining properties - a use case for class decorators?

Guido van Rossum guido at python.org
Sun Oct 16 18:20:13 CEST 2005

On 10/16/05, Calvin Spealman <ironfroggy at gmail.com> wrote:
> On 10/16/05, Guido van Rossum <guido at python.org> wrote:
> > Nick, and everybody else trying to find a "solution" for this
> > "problem", please don't. There's nothing wrong with having the three
> > accessor methods explicitly in the namespace, it's clear, and probably
> > less typing (and certainly less indenting!). Just write this:
> >
> >     class C:
> >         def getFoo(self): ...
> >         def setFoo(self): ...
> >         foo = property(getFoo, setFoo)
> Does this necessisarily mean a 'no' still for class decorators, or do
> you just not like this particular use case for them. Or, are you
> perhaps against this proposal due to its use of nested classes?

I'm still -0 on class decorators pending good use cases. I'm -1 on
using a class decorator (if we were to introduce them) for get/set
properties; it doesn't save writing and it doesn't save reading.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list