
Jan. 21, 2016
4:59 a.m.
My idea for handling this kind of thing is: for new x in things: funcs.append(lambda: dosomethingwith(x)) The 'new' modifier can be applied to any assignment target, and conceptually has the effect of creating a new binding instead of changing an existing binding. There is a very simple way to implement this in CPython: create a new cell each time instead of replacing the contents of an existing cell. -- Greg