Why won't the run-time error reporter point to the error position with a caret like the syntax error reporter does? It knows exactly where the error is.

jsalsman at gmail.com jsalsman at gmail.com
Wed Jul 31 23:19:58 EDT 2019


Honestly this is the only thing in over half a decade of daily python use which has disappointed me enough to want to ask the devs:

>>> print(1/)
  File "<stdin>", line 1
    print(1/)
            ^
SyntaxError: invalid syntax
>>> print(1/1, 1/0, 1/1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: division by zero
>>> print(
... 1
... /
... 1
... ,
... 1
... /
... 0 # line 8
... ,
... 1
... /
... 1
... )
Traceback (most recent call last):
  File "<stdin>", line 8, in <module>
ZeroDivisionError: division by zero

Why not print the caret?



More information about the Python-list mailing list