[issue38556] Walrus operator in list comprehensions [Python 3.8.0]
Anselm Kiefner
report at bugs.python.org
Sat Jul 11 12:27:11 EDT 2020
Anselm Kiefner <amogorkon at gmail.com> added the comment:
I just stumbled over this same restriction and when I googled for "SyntaxError: cannot assign to named expression", 0 actual results showed - an absolute unicorn for a Python error.
> "Due to design constraints in the reference implementation (the symbol table analyser cannot easily detect when names are re-used between the leftmost comprehension iterable expression and the rest of the comprehension), named expressions are disallowed entirely as part of comprehension iterable expressions (the part after each "in", and before any subsequent "if" or "for" keyword):"
Might the new PEG parser maybe help alleviate this restriction, so we could declare this a bug instead?
----------
nosy: +Anselm Kiefner
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38556>
_______________________________________
More information about the Python-bugs-list
mailing list