New submission from Arne Recknagel <arne.reckna...@hotmail.com>:
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). ---------- messages: 353203 nosy: arne, emilyemorehouse priority: normal severity: normal status: open title: Allowing conditions with assignment expressions in comprehensions without parantheses versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38277> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com