improve a Python error message
beliavsky at aol.com
beliavsky at aol.com
Thu Apr 8 15:13:07 EDT 2004
The Python code
x = (1,2
print x
gives an error message
File "err.py", line 2
print x
^
SyntaxError: invalid syntax
The real error is on line 1, but I guess the error is attributed to
line 2 because the code would be legal if the 2nd line were (for
example) a closing parenthesis. I wonder if the error message Python
produces could be improved. It is technically correct but could
confuse a beginner. Perhaps the message could be
SyntaxError: invalid syntax (missing closing parenthesis on previous
line?)
More information about the Python-list
mailing list