I want to create a dictionary of lambda functions, something like this:
test = {"test_{}".format(i): lambda x : x + i for i in range(3)}
But when I try it out as follows:
print(test["test_0"] (0))
print(test["test_1"] (0))
print(test["test_2"] (0))
I get as a result:
2
2
2
Somehow all the lambdas are the same! What is going on and how do i fix it?