On Oct 15, 12:10 pm, looping <[EMAIL PROTECTED]> wrote: > > Why lambda doesn't work ? (variable scope problem ?)
This is a well known issue of for loops. Some believe it to be a bug but Guido says it is a design decision, in the sense that Python always do late binding. If you browse this list you will find many discussions. Basically if you do funclist = [] for i in 1,2,3: def f(): print i funclist.append(f) you will get funclist[0]() == funclist[1]() == funclist[2]() == 3 (you get the latest binding of "i"). As you see, it has nothing to do with lambdas. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list