I am new to python, and require to generate something like the following, a list of similar functions using a loop and store them in a list.
I mean something along the lines of the following:
funcs = []
for i in range(1,11):
def temp():
print i
funcs.append(temp)
Of course I know this won't work since its only temp being stored throughout the list and doing something like
funcs[3]
funcs[7]
will give
10
10
instead of
3
7
I don't wan't to use lambdas as the functions have to be a little more complex than what they allow.