[Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)
Terry Reedy
tjreedy at udel.edu
Mon Jun 25 15:50:34 EDT 2018
More information about the Python-Dev mailing list
Mon Jun 25 15:50:34 EDT 2018
- Previous message (by thread): [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)
- Next message (by thread): [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 6/25/2018 8:25 AM, Paul Moore wrote: > On 25 June 2018 at 12:44, Nick Coghlan <ncoghlan at gmail.com> wrote: >> Unfortunately, I think the key rationale for (b) is that if you >> *don't* do something along those lines, then there's a different >> strange scoping discrepancy that arises between the non-comprehension >> forms of container displays and the comprehension forms: > > I've been mostly ignoring this proposal for a while now, so I'm going > to respond here in the context of someone with a bit of an idea of the > underlying complexities, but otherwise coming at it as a new proposal. > >> >> (NAME := EXPR,) # Binds a local >> tuple(NAME := EXPR for __ in range(1)) # Doesn't bind a local Of course not, in local scopes where is it not executed. But it would, in the nested function where the assignment *is* executed. Ditto for all of the following. >> [NAME := EXPR] # Binds a local >> [NAME := EXPR for __ in range(1)] # Doesn't bind a local >> list(NAME := EXPR for __ in range(1)) # Doesn't bind a local >> >> {NAME := EXPR} # Binds a local >> {NAME := EXPR for __ in range(1)} # Doesn't bind a local >> set(NAME := EXPR for __ in range(1)) # Doesn't bind a local >> >> {NAME := EXPR : EXPR2} # Binds a local >> {NAME := EXPR : EXPR2 for __ in range(1)} # Doesn't bind a local >> set((NAME := EXPR, EXPR2) for __ in range(1)) # Doesn't bind a local > > None of those "discrepancies" bother me in the slightest, Me neither. I pretty much agree with the rest of what Paul said. If we don't want comprehensions to execute in a nested scope, then we should not create one. See my response to Guido for a possible alternative. -- Terry Jan Reedy
- Previous message (by thread): [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)
- Next message (by thread): [Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list