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

Skip Montanaro skip at pobox.com
Thu Apr 8 20:36:01 EDT 2004

    Mark> I've put a patch at python.org/sf/932100 which does this, plus
    Mark> changes to Grammar/Grammar, compile.c etc - it implements the
    Mark> syntax:

    Mark>       [as classmethod]
    Mark>       def foo(cls): pass

    Mark> The newline is optional:

    Mark>       [as foo, bar, baz] def foo(cls): pass

    Mark> is also legal.

Does it treat '[' and 'as' as separate tokens so whitespace can occur
between them?

Note that the second alternative is likely to break all sorts of auxiliary
tools which scan Python source.  etags/ctags and python-mode come to mind.
Clearly, python-mode is well within our domain, but other syntax coloring
tools aren't.


More information about the Python-Dev mailing list