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

Andrew Bennetts andrew-pythondev at puzzling.org
Tue Mar 30 17:27:19 EST 2004


On Tue, Mar 30, 2004 at 01:21:18PM -0800, Guido van Rossum wrote:
> > Another possibility that has been suggested is
> > 
> > [decorator] 
> > def func(arg, arg):
> 
> And one that I currently favor.  I'm out of bandwidth to participate
> on a msg-by-msg basis, but perhaps folks can see if they can come to
> terms with this solution?

The most obvious issues I see with this is are that:
  - grepping for "def func" won't show any sign that its decorated, and 
  - it looks like normal syntax, so it looks like expressions should
    work, e.g.

        [decorator1] + [decorator2]
        def func(arg, arg):

    or even:

        get_std_decorators()   # Returns a list
        def func(arg, arg):
        
    I'm pretty sure this isn't the intention, though.  I can imagine some
    posts to comp.lang.python asking how to do the above...
  
Neither of these are fatal flaws, but I think I still prefer:

    def func(args) [decorator]:

-Andrew.




More information about the Python-Dev mailing list