Syntax Error at end of file

Skip Montanaro skip at pobox.com
Wed Jul 3 08:10:33 EDT 2002


    Thomas> But it would be very nice if the python parser would tell what
    Thomas> input token it was searching for, and where the start token is.

In a similar thread which occurred just a few days ago it was observed (by
Tim Peters, I think) that the set of acceptable characters at any particular
point in the parse is big, so enumerating them in the error message would be
counterproductive and would just serve to confuse the issue in most cases.

Most people don't add huge gobs of text to developing source code between
debug runs, so if you get a SyntaxError, it's almost always in the code
entered most recently.  This helps narrow down the possible sources of the
error dramatically, and with the exception of things that come in pairs and
which can extend parsing of a construct across multiple lines (triple quoted
strings and various paren-list things) the cause of most SyntaxErrors is
generally within a line or two of the point of detection.

-- 
Skip Montanaro
skip at pobox.com
consulting: http://manatee.mojam.com/~skip/resume.html





More information about the Python-list mailing list