Andre Roberge <andre.robe...@gmail.com> added the comment:
I understand. I reported this issue when one of my newest tests failed with Python 3.10 and 3.11. Actually, using friendly-traceback, using the location of the exception as indicated by cPython 3.10 and 3.11, here's part of the explanation it gives: The following lines of code would not cause any `SyntaxError`: sum + [i for i in [1, 2, 3] if i%2==0] sum - [i for i in [1, 2, 3] if i%2==0] sum * [i for i in [1, 2, 3] if i%2==0] sum, [i for i in [1, 2, 3] if i%2==0] Note: these are just some of the possible choices and that some of them might raise other types of exceptions. So, I agree with you that suggesting a comma would be appropriate. (I also miss the suggestion of inserting an equal sign above). Meanwhile, with prior versions of cPython, here's the suggestion that was offered: You used square brackets, `[...]` instead of parentheses. Write the following instead: sum(i for i in [1, 2, 3] if i%2==0) So, since using the suggestion currently by cPython (3.10, 3.11), one could get a syntactically valid statement by adding a comma, I cannot really argue that this is a bug. (Sorry, I should have checked in more details before.) Therefore, I agree that this issue should probably be closed ... unless you find that suggesting a missing comma while there are many other possible operators that could be inserted could be considered as misleading. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45801> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com