On 22 April 2018 at 01:44, David Mertz <me...@gnosis.cx> wrote:
> It feels very strange that the PEP tries to do two almost entirely unrelated
> things. Assignment expressions are one thing, with merits and demerits
> discussed at length.
>
> But "fixing" comprehension scoping is pretty much completely orthogonal.
> Sure, it might be a good idea. And yes there are interactions between the
> behaviors. However, trying to shoehorn the one issue into a PEP on a
> different topic makes all of it harder to accept.
>
> The "broken" scoping in some slightly strange edge cases can and has been
> shown in lots of examples that don't use assignment expressions. Whether or
> not that should be changed needn't be linked to the real purpose of this
> PEP.

The reason it's covered in the PEP is because the PEP doesn't want to
lock in the current "binds the name in the surrounding scope"
semantics when assignment expressions are used in the outermost
iterable in a comprehension.

However, resolving that question *could* be postponed more simply by
making that a SyntaxError, rather than trying to move the expression
evaluation inside the implicitly nested scope.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to