[Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)
tim.peters at gmail.com
Wed Jun 27 20:44:42 EDT 2018
> If the parent has a matching parentlocal declaration for the same
> name then the original
> > really refers to the grandparent - and so on.
> Ah, I missed that part, sorry -- I withdraw that particular
Good! I have another reply that crossed in the mail.
> Still, this seems like a major addition (seeing as it comes
> with a new keyword) whose justification is very little more
> than "it makes explaining comprehension scopes easier".
> I agree - it has no other sane use case I can see, and "parentlocal" isn't
_needed_ to capture the intended semantics in by-hand translations of
I don't even think it makes "explaining" easier. It doesn't eliminate any
corner cases, it just pushes them into the definition of what
What it would do is make writing synthetic functions "by hand" to implement
comprehensions more uniform, because "parentlocal" would handle the corner
cases by itself instead of making the programmer figure out when and where
they need to type "nonlocal", "global", and/or cruft to establish a name as
local to a block in which the name otherwise does't appear as a binding
But to the extent that doing such translations by hand is meant to be
"educational", it's more educational to learn how to do that stuff yourself.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev