[Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part) (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Wed Jun 27 09:38:54 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 ]
Nick Coghlan wrote:
actually made those semantics available as an explicit "parentlocal NAME" declaration ...:
def listcomp(outermostiter): parentlocal item result = [] for x in outermostiter: item = x result.append(x) return result exprresult = listcomp(items)
I'm not sure that's possible. If I understand correctly, part of the definition of "parent local" is that "parent" refers to the nearest enclosing non-comprehension scope, to give the expected result for nested comprehensions. If that's so, then it's impossible to fully decouple its definition from comprehensions.
-- Greg
- 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 ]