B
beliavsky
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?)
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?)