Common LISP-style closures with Python

Ian Kelly ian.g.kelly at gmail.com
Sun Feb 5 15:58:31 EST 2012


On Sat, Feb 4, 2012 at 9:19 PM, Antti J Ylikoski <antti.ylikoski at tkk.fi> wrote:
>> I'm not sure how naughty this is, but the same thing can be done without
>> using
>> nonlocal by storing the local state as an attribute of the enclosed
>> function
>> object:
>>
>> ...
>
> Yes, I do know that, but then it would not be a closure :-)))))))))

Sure it is.  Where do you think it looks up the function object?

Cheers,
Ian



More information about the Python-list mailing list