Message353203
All code is run on python build from the current 3.8 branch.
The following doesn't work:
>>> [x for x in 'foo' if y := True]
File "<stdin>", line 1
[x for x in 'foo' if y := True]
^
SyntaxError: invalid syntax
While this does:
>>> [x for x in 'foo' if (y := True)]
['f', 'o', 'o']
Since assignment expressions work without parentheses in normal if-clauses and there being no mention on it explicitly being disallowed, this seems to either be a bug or an oversight in the documentation (with my own opinion, for what it's worth, being that it's a bug). |
|
Date |
User |
Action |
Args |
2019-09-25 14:20:15 | arne | set | recipients:
+ arne, emilyemorehouse |
2019-09-25 14:20:15 | arne | set | messageid: <1569421215.61.0.96035385426.issue38277@roundup.psfhosted.org> |
2019-09-25 14:20:15 | arne | link | issue38277 messages |
2019-09-25 14:20:15 | arne | create | |
|