[Python-ideas] Proposal: A Reduce-Map Comprehension and a "last" builtin

Greg Ewing greg.ewing at canterbury.ac.nz
Sun May 27 20:17:35 EDT 2018


Nick Coghlan wrote:
> Aye, while I still don't want comprehensions to implicitly create new 
> locals in their parent scope, I've come around on the utility of letting 
> inline assignment targets be implicitly nonlocal references to the 
> nearest block scope.

What if you're only intending to use it locally within the
comprehension? Would you have to put a dummy assignment in
the surrounding scope to avoid a NameError? That doesn't
sound very nice.

-- 
Greg


More information about the Python-ideas mailing list