[Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)
p.f.moore at gmail.com
Wed Jun 27 11:23:49 EDT 2018
On 27 June 2018 at 15:39, Nick Coghlan <ncoghlan at gmail.com> wrote:
> However, PEP 572 in its current form takes the position "parent local
> scoping is sufficiently useful to make it a required pre-requisite for
> adding assignment expressions, but not useful enough to expose as a
> new scope declaration primitive", and I've come to the view that it
> really is the "A+B=MAGIC!" aspect of the current proposal that bothers
> me, whereas "A+B implies C for <pragmatic reasons>" doesn't bother me
> any more than the implicit non-local references introduced as part of
> the original lexical scoping changes bother me.
>From my reading, PEP 572 takes the position that "parent local
scoping" is what people expect from assignment expressions *in
comprehensions* and it's useful enough that there is no reason not to
make that the behaviour. The behaviour isn't generally useful enough
to be worth exposing as a primitive (it's not even useful enough for
the PEP to give it an explicit name!) so it's just a special case for
assignment expressions in comprehensions/generators.
That seems to me like a classic example of practicality beating purity.
More information about the Python-Dev