[Python-Dev] Re: Call for defense of @decorators

Guido van Rossum guido at python.org
Fri Aug 6 17:39:55 CEST 2004


> >No, you can put multiple decorators on a single line -- you just need a
> >newline before the def.  From test_decorators.py:
> >
> >         class C(object):
> >             @funcattrs(abc=1) @staticmethod
> >             def foo(): return 42
> >
> >Probably not good style (but neither is "if cond: stmt" I guess).
> 
> *shudder*
> 
> Can we change this?  The positive benefits that the @ syntax *does*
> have, seem completely lost by doing this.

That's a bit strong, but yes, it would be trivial to change.  If
that's all that's needed to save @deco, it's a lot easier than ripping
the whole thing out... :-)

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


More information about the Python-Dev mailing list