[Python-Dev] Re: PEP 318: Decorators last before colon
Guido van Rossum
guido at python.org
Thu Apr 1 14:21:12 EST 2004
> How about INDENT[...]:DEDENT? <0.5 serious>
Alas, won't work -- if the decoration is the first thing in a class
body, you'd have something starting with double indent, but the lexer
never gives you that.
class C:
[staticmethod]
def foo():
pass
This would be tokenized as
'class'
'C'
':'
NEWLINE
INDENT
'['
'staticmethod'
']'
NEWLINE
<ILLEGAL DEDENT>
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list