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

Guido van Rossum guido at python.org
Mon Apr 5 14:03:09 EDT 2004


> > I appreciate the suggestion, but the current parser can't handle that.
> 
> Would it not be possible to cheat and make the lexer transform 
> 
> 	"[" WHITESPACE "as" WHITESPACE IDENTIFIER 
> 
> into an LBRACE-AS token (which I assume would make the parser's job
> simple).

I don't think without extreme hackery, but feel free to prove me wrong
by producing a patch.  (A problem is, there could be newlines and
comments inside the WHITESPACE.  Backtracking over that would require
the lexer to have an arbitrary-length buffer.)

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list