Message406295
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. |
|
Date |
User |
Action |
Args |
2021-11-13 20:13:56 | aroberge | set | recipients:
+ aroberge, lys.nikolaou, pablogsal |
2021-11-13 20:13:56 | aroberge | set | messageid: <1636834436.1.0.504908993.issue45801@roundup.psfhosted.org> |
2021-11-13 20:13:56 | aroberge | link | issue45801 messages |
2021-11-13 20:13:55 | aroberge | create | |
|