This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Anselm Kiefner
Recipients Anselm Kiefner, EGN, eric.smith, steven.daprano, xtreak
Date 2020-07-11.16:27:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1594484831.56.0.149501643596.issue38556@roundup.psfhosted.org>
In-reply-to
Content
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?
History
Date User Action Args
2020-07-11 16:27:11Anselm Kiefnersetrecipients: + Anselm Kiefner, eric.smith, steven.daprano, xtreak, EGN
2020-07-11 16:27:11Anselm Kiefnersetmessageid: <1594484831.56.0.149501643596.issue38556@roundup.psfhosted.org>
2020-07-11 16:27:11Anselm Kiefnerlinkissue38556 messages
2020-07-11 16:27:11Anselm Kiefnercreate