When I try to use
>>> print max Traceback (most recent call last): ... File "<interactive input>", line 1 print max ^ SyntaxError: Missing parentheses in call to 'print'
Ok, now I get it, I just forgot to port my Python 2 code.
But now when I try to print the result of a function:
>>> print max([1,2]) Traceback (most recent call last): ... print max([1,2]) ^ SyntaxError: invalid syntax
print max.__call__(23) ^ SyntaxError: invalid syntax
(Note that the cursor is pointing to the character before the first dot in that case.)
The message is different (and slightly misleading, since the marker is below the
Why isn't Python able to detect the problem earlier?
Note: This question was inspired by the confusion around this question: Pandas read.csv syntax error, where a few Python experts missed the real issue because of the misleading error message.