[Python-ideas] Tweaking closures and lexical scoping to include the function being defined

Terry Reedy tjreedy at udel.edu
Thu Sep 29 00:46:15 CEST 2011


On 9/28/2011 5:57 PM, Jan Kaliszewski wrote:
> Terry Reedy dixit (2011-09-27, 21:17):
>
>> defining a function inside a loop

Insert 'does not', which somehow got omitted or deleted.

 >> magically causes define-time binding of names in the body.
>
> No, it does not cause such a binding.

Of course not, as I have said many times over the last decade plus, most 
recently just 4 hours earlier (at 17:10), when I said "People are 
assuming [wrongly, when using a local name that matches an outer 
enclosing loop name] that 'i' is immediately bound to its 'current' 
value, just like default args."

Sorry for the confusing omission. My intention was to list this as a 
delusion, not as a fact.

-- 
Terry Jan Reedy




More information about the Python-ideas mailing list