Possible Duplicate:
Creating lambda inside a loop
In the code below, invoking any member of the returned array of closures prints the number 4.
def go():
x = []
for i in range(5):
def y(): print i
x.append(y)
return x
I would like each member of the closure to print the number that i
was when the closure was defined.