attribute decorators

DH aj108778 at gmail.com
Fri Dec 22 18:51:32 EST 2006


Fredrik Lundh wrote:
> Gert Cuykens wrote:
>
> > would it not be nice if you could assign decorators to attributes too ?
> > for example
> >
> > class C:
> >     @staticattribute
> >     data='hello'
> >
> > or
> >
> > class C:
> >     @privateattribute
> >     data='hello'
>
> and that would do what?
>
> </F>

Don't mind Fredrik's trolling.  Your examples are perfectly clear,
however, a similar call for extending the use of decorators to other
structures besides functions was rejected:
http://lambda-the-ultimate.org/node/1389

I'm not sure if that decision still stands with Python 3000, however,
Guido has changed his mind before:
http://www.artima.com/weblogs/viewpost.jsp?thread=87182




More information about the Python-list mailing list