Ezio Melotti added the comment: Looking at the changes in the patch it seems to me that, in at least a few cases, it's better to have a bare "invalid syntax" than a misleading error. For example:
>>> dict(a = i for i in range(10)) + SyntaxError: invalid syntax - ')' expected The () are ok, the message is misleading. >>> obj.None = 1 +SyntaxError: invalid syntax - name expected 'name' here is a bit vague. >>> def f(x, None): ... pass +SyntaxError: invalid syntax - ')' expected >>> def f(*None): ... pass +SyntaxError: invalid syntax - ')' expected Here the () are ok too. >>> def f(**None): ... pass +SyntaxError: invalid syntax - name expected Here I would have expected the "')' expected" like in the previous example, but there's "name" instead (which is a bit better, albeit inconsistent). I wouldn't consider this an improvement, but for other situations the error message is probably useful. I see 3 options here: 1) we find a way to show the expected token only when the message is not misleading; 2) if the expected token is useful more often than it is misleading, then we could apply the patch as is; 3) if it is misleading more often than it is useful, it's probably better to reject the patch. ---------- nosy: +ezio.melotti _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1634034> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com