Decorator Syntax

Benjamin Kaplan benjamin.kaplan at case.edu
Mon Mar 21 21:31:22 EDT 2011


On Mon, Mar 21, 2011 at 8:59 PM, Mike Patterson
<mikepatterson77 at gmail.com> wrote:
> In my Python class the other day, the professor was going over
> decorators and he briefly mentioned that there had been this huge
> debate about the syntax and using the @ sign to signify decorators.
>
> I read about the alternative forms proposed here (http://
> www.python.org/dev/peps/pep-0318/#syntax-alternatives).
>
> Has anyone thought about just using dec to declare a decorator?
>
> For example:
> dec dec2
> dec dec1
> def func(arg1, arg2, ...):
>    pass
> --

dec and def look too similar. It would get confusing. Also, it
wouldn't be immediately obvious that the line is associated with the
function declaration below. The whole point in the decorators is that
it makes it easier to tell that the function is being wrapped.



More information about the Python-list mailing list