I'm all for clear and helpful error messages, but this feels a tad too verbose (and even a bit patronizing) to me. But the highlighting of character look-alikes is very helpful.

Perhaps something like:

SyntaxError: invalid character in identifier
    -->2:   print(“Squares:”)
An identifier contains one or more unallowed Unicode characters.
It is likely the "curly quote" unicode quotation mark, rather than
the required ASCII single or double quote was used for a string.

I'm assuming that this would detect some of the common "look alikes" and give a specific suggestion as above.

Keep in mind that anyone coding Python is going to see a LOT of SyntaxErrors -- we don't need to present a message as though they've never seen such an error before. But it IS helpful to point out errors that are hard to see with a glance at the code.


Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython