[Python-Dev] Re: PEP 318: Decorators last before colon

Michel Pelletier michel at dialnetwork.com
Wed Mar 31 13:59:33 EST 2004


> Message: 1
> Date: Wed, 31 Mar 2004 18:10:23 +0200
> From: Simon Percivall <s.percivall at chello.se>
> Subject: Re: [Python-Dev] Re: PEP 318: Decorators last before colon

I've been following this discussion closely and I would like to voice my
opinion.

Please don't add any decorator syntax to Python, at least not yet.  All
of the proposals I have seen so far are, to be blunt, and in my opinion
of course, ugly and are getting uglier as the discussion ensues.

I see nothing wrong, at least for the present, with the status quo
decorators that follow a function or class definition.  They are
explicit, functionally equivalent, use the existing and completely
understandable syntax, and are so rarely used by only the *most*
experienced and advanced programmers that violating the beauty of the
language is unjustified.

> I'm not sure <decorator> is the best solution but it sure is better 
> than [decorator].

I think they're both bad, especially on the line preceding the
definition.

>  Someone learning Python will probably be profoundly 
> confused when seeing that special case. 

I agree.

> It also really feels like the 
> decorators are decoupled from the function. 

And to me they always were and always will be even with the help of
syntax sugar.  I can accept that, in the rarest cases that I need to use
them.  

What's worse, if any of these proposals were to be accepted, I will have
to go and look up the special syntax in those very rarest cases, instead
of just spelling it the way that seems most natural to me, as a Python
programmer.

> The coupling between the 
> decorators and the function would perhaps not appear to be greater with 
> another syntax; but it would stand out.
> 
> Unlike docstrings which are used a lot and which documentation and 
> books explain early on, decorators won't be used that much.

I agree wholeheartedly, which is why I would hate to see special syntax.

-Michel




More information about the Python-Dev mailing list