En Tue, 20 May 2008 16:22:10 -0300, Joe P. Cool <[EMAIL PROTECTED]> escribió:
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 :)

Something like that. The last line of source *must* end in a newline (be it a comment or not); this is a known limitation. See py_compile.py for an example.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to