[Python-ideas] For-loop variable scope: simultaneous possession and ingestion of cake
Arnaud Delobelle
arnodel at googlemail.com
Tue Oct 14 08:02:40 CEST 2008
On 14 Oct 2008, at 05:03, Dillon Collins wrote:
> On Monday 13 October 2008, Arnaud Delobelle wrote:
>> It's inefficient because it works by deconstructing and
>> reconstructing
>> the function bytecode.
>
> That's not necessary. Just make a new closure for it. Here's some
> code (I
> was bored/curious). The function reclose_kwds is provided for
> fun. Enjoy:
But that doesn't work with global variables, does it? Globals are the
reason why I had to scan the bytecode
--
Arnaud
More information about the Python-ideas
mailing list