On Mon, 29 Dec 2025 at 22:47, Peter J. Holzer <[email protected]> wrote: > As for the error message, I agree that "SyntaxError: invalid syntax" is > a pretty uninformative message. Python error messages in general have > become very good over the last few years, so that feels like a bit of a > throwback. I think it would be generally useful to improve that message > (maybe something like "expected identfier, got reserved word 'class'").
I wouldn't call it a throwback. Every improvement to the error messages happened because someone wrote code to detect a specific category of error and give a more helpful message. So this is just one that hasn't been done yet. Someone just needs to write the PR. Though, given that most people write code with an editor that knows Python keywords, and even the REPL will colorize things if your terminal supports it (as of 3.13), this might not be so big an issue in practice. ChrisA -- https://mail.python.org/mailman3//lists/python-list.python.org
