Author ncoghlan
Recipients barry, emilyemorehouse, eric.smith, gvanrossum, joernheissler, koobs, miss-islington, ncoghlan, nedbat, pablogsal, rhettinger, serhiy.storchaka, steven.daprano, tim.peters, veky, willingc, xtreak
Date 2019-08-05.04:32:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1564979546.23.0.674845869275.issue35224@roundup.psfhosted.org>
In-reply-to
Content
#37757 now has an associated PR adding the missing TargetScopeError cases: https://github.com/python/cpython/pull/15131

There's one case where it goes beyond what the PEP specifies: because the outermost iterable expression gets evaluated in a different scope from the rest of the comprehension, it just flat out prohibits the use of assignment expressions in comprehension iterable expressions.

This was one of the cases where we explicitly didn't want the CPython implementation behaviour to leak into the language specification (as name binding in the outermost iterable expression would create an unrelated binding in the containing scope, while name binding in other iterable expressions would rebind any conflicting iteration variable in the comprehension), so the current PR takes the more conservative path, and defers allowing name binding in the iterable expressions until a specific use case for doing so is presented).
History
Date User Action Args
2019-08-05 04:32:26ncoghlansetrecipients: + ncoghlan, gvanrossum, tim.peters, barry, rhettinger, eric.smith, nedbat, steven.daprano, serhiy.storchaka, koobs, willingc, veky, emilyemorehouse, joernheissler, pablogsal, miss-islington, xtreak
2019-08-05 04:32:26ncoghlansetmessageid: <1564979546.23.0.674845869275.issue35224@roundup.psfhosted.org>
2019-08-05 04:32:26ncoghlanlinkissue35224 messages
2019-08-05 04:32:25ncoghlancreate