I've tried the following code in the python interpreter:
>>> def say(n):
... print n
...
>>> say(12)
12
>>> test = []
>>> for each in range(30):
... test.append(lambda: say(each))
...
>>> test[0]()
29
>>> test[13]()
29
This seems quite weird, shouldn't it return 0 and 13 on those last two calls. I've tried looking directly at test itself, and it seems like all the functions in it are distinct
>>> test[0] == test[1]
False
>>> test[0]
<function <lambda> at 0x203e140>
>>> test[1]
<function <lambda> at 0x203e1b8>
Any idea why they're all behaving the same way?