What's wrong with that comment?
Joe P. Cool
joe.p.cool at googlemail.com
Tue May 20 15:22:10 EDT 2008
Ludwig Miniatur wrote:
> For example:
> #!/usr/bin/env python
>
> from parser import suite, ast2list
> fh = file(__file__)
> s = fh.read()
> fh.close()
> ast = suite(s)
>
> while False:
> print "hello world"
> # comment
>
> Looks like a little bug in parser; but what I don't understand is that
> I thought parser was build with the current syntax of python.
I didn't read the grammar but I assume that Python grammar requires a
comment to have the form #.*<end-of-line>.
>
> So, why can python run the script (an it can if you comment out the
> line "ast = suite(s)") but parser can't?
The interpreter probably appends a newline after the input stream as a
friendly service :)
--
Joe
More information about the Python-list
mailing list