Decorator syntax (was Re: PEP 318 - PyFIT comments)

David Eppstein eppstein at ics.uci.edu
Wed Aug 4 19:18:46 EDT 2004


In article <mailman.1162.1091660561.5135.python-list at python.org>,
 "Delaney, Timothy C (Timothy)" <tdelaney at avaya.com> wrote:

> Besides, @ could possibly be reused for function attributes, meaning
> it's less "wasted" - there's also an obvious correlation in that both
> decorators and function attributes operate on the function object:
> 
> @classmethod
> def func (args):
>     @attr = 1
>     pass
> 
> Tim Delaney

Hey, an actual reason for the restricted syntax in the current decorator 
implementation: it makes it less likely that @decorators will conflict 
with potential other @syntaxes such as this @attribute one.

-- 
David Eppstein
Computer Science Dept., Univ. of California, Irvine
http://www.ics.uci.edu/~eppstein/



More information about the Python-list mailing list