funcs = []
for i in range(3):
    a = i
    func = lambda x: a
    funcs.append(func)
print [func(0) for func in funcs]
I would like this to print [0,1,2], instead it prints [2,2,2].  I see what's going on, the question is how do I circumvent this?
 
     
    