Why not just show the out-of-range index?

John Machin sjmachin at lexicon.net
Sun Dec 3 21:27:40 EST 2006


mensanator at aol.com wrote:
> John Machin wrote:
> > Add "Syntax Error: invalid syntax" to the list ...
>
> But at least if you're using IDLE, the point of syntax error
> is highlighted.
>

Same when using the interactive interpreter, the point of syntax error
is highlighted with a caret. However the highlighting of WHERE is
useless to people who don't have a clue WHAT the error is, and it needs
a forensic guru to suss it out as for example Peter Otten did, only
yesterday:
"""
Are you perhaps mixing tabs and spaces?

>>> def f():

...     print "hello" # four spaces before 'print'
...     return 42     # one tab before 'return'
  File "<stdin>", line 3
    return 42
    ^
SyntaxError: invalid syntax 
"""




More information about the Python-list mailing list