[Python-Dev] odd interpreter feature
Guido van Rossum
guido@python.org
Wed, 07 May 2003 11:33:31 -0400
> Guido> And yes, it's a wart, but I don't know how to fix it.
>
> I did a little digging and noticed this comment dating from v 2.5 (Jul 91):
>
> /* Lines with only whitespace and/or comments
> shouldn't affect the indentation and are
> not passed to the parser as NEWLINE tokens,
> except *totally* empty lines in interactive
> mode, which signal the end of a command group. */
>
> Not surprisingly, given the age of the change, your fingerprints are all
> over it. ;-)
>
> I suspect if the code beneath that comment was executed only when the
> indentation level is zero we'd be okay, but I don't know if the tokenizer
> has that sort of information available. I'll do a little more poking
> around.
Please do. The indentation level should be easily available, since it
is computed by the tokenizer.
--Guido van Rossum (home page: http://www.python.org/~guido/)