if __name__=='__main__': main()
Jeremy Hylton
jeremy at alum.mit.edu
Fri Jan 3 09:30:38 EST 2003
jaime.suarez at crossmatch.net (jaime suarez) wrote in message news:<d3f86b28.0212230820.34a29030 at posting.google.com>...
> if __name__=='__main__':
> main()
>
> THE PROBLEM is that I had to enter a newline after
> main()!!
>
Here's a late response to this issue. I was just butting heads with
it on Tuesday, so the it seems fresh for me.
This error only occurs if you are parsing a string. Python's parser
has separate APIs for parsing from a file (a C FILE *) and from a
string (a C char *). The file version of the parser APIs doesn't
require a trailing newline, but the string version does. This
difference is a bug in the implementation. Neither version of the API
should care about the trailing newline.
Jeremy
More information about the Python-list
mailing list