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

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Wed Aug 4 19:01:02 EDT 2004


Christopher T King wrote:

> On 4 Aug 2004, Nick Vargish wrote:
> 
>> I just don't know where else to voice my opinion on this matter, but
>> I absolutely hate the new decorator syntax.
> 
> I wish PEPs had a method through which votes could be cast, for or
> against the PEP (or parts of it), not unlike Bugzilla bugs.  At least

The last vote was an unmitigated disaster. And there appears to be no
more agreement on the correct syntax for decorators. The difference is
that decorator syntax will have significant benefits for a certain class
of project.

> democratic input.  Either way, I really wish he would hold off on
> decorators until there's a consensus on them, rather than forcing
> them in amidst all the disagreements surrounding them.

There are significant projects that will greatly benefit from decorator
syntax - for example, PyObjC.

Personally, I don't overly like the new syntax - I much preferred def
func (args) [decorators] - and I would have preferred not to "waste" @
for them, but I can definitely live with the decision. Some usable
decorator syntax is IMO more important than none.

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



More information about the Python-list mailing list