Suppose I have the following code
callbacks = []
for i in range(10):
callbacks.append(lambda x: i)
all functions in callbacks will return the final value of i. How can I create callbacks that return the current value for i at creation time?