Common LISP-style closures with Python

Ian Kelly ian.g.kelly at
Sun Feb 5 21:58:31 CET 2012

On Sat, Feb 4, 2012 at 9:19 PM, Antti J Ylikoski <antti.ylikoski at> 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?


More information about the Python-list mailing list