> I tried it but I got a syntax error. The interpreter didn't like the > equals sign in the lambda. I am using python 2.3.4. Is there another way > of writing that?
Strange. This script works and shows the desired behaviour - python is also 2.3.4: def foo(x): print x fs = [lambda: foo(i) for i in xrange(5)] for f in fs: f() fs = [lambda x=i: foo(x) for i in xrange(5)] for f in fs: f() -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list