
On Wed, Jul 20, 2016 at 1:03 AM, Nick Coghlan <ncoghlan@gmail.com> wrote:
The reason that can help is that the main problem with "improving" error messages, is that it can be really hard to tell whether the improvements are actually improvements or not (in some cases it's obvious, but in others it's hard to decide when you've reached a point of "good enough", so you throw up your hands and say "Eh, it's at least distinctive enough that people will be able to find it on Stack Overflow").
Plus, there are all sorts of errors that look very different to humans, but identical to the parser. Steven showed us an example where an invalid character looked like it belonged in the identifier, yet to the parser it's just "this Unicode category isn't valid here", same as the bad-quote one. In a *very* few situations, a single error is common enough to be worth special-casing (eg print without parentheses, in recent Pythons), but otherwise, Stack Overflow or python-list will do a far better job of diagnosis than the lexer ever can. Ultimately, syntax errors represent an error in translation from a human's concept to the text that's given to the interpreter, and trying to reconstruct the concept from the errant text is better done by a human than a computer. Obviously it's great when the computer can read your mind, but it's never going to be perfect. ChrisA