[Python-Dev] Re: PEP 318: Decorators last before colon
Andrew Koenig
ark-mlist at att.net
Mon Apr 5 12:49:53 EDT 2004
> > > What about:
> > >
> > > [as classmethod]
> > > def foo(bar, baz):
> > > pass
> Since that is illegal syntax today, it would alleviate my primary
> concern with decorator-before-def syntax. And the 'as' keyword does
> help tie it to the following def.
Indeed. And we could even extend it to allow a single set of decorators to
apply to multiple function definitions, as follows:
[as classmethod]:
def foo(bar, baz):
pass
def bar(foo, baz):
pass
Of course, the colon would be required if and only if an indent follows it.
(I still prefer decorators after the parameters, but this version pretty
much solves the same problems and answers my non-aesthetic objections)
More information about the Python-Dev
mailing list