Arnaud Delobelle wrote: > "Diez B. Roggisch" <de...@nospam.web.de> writes: > >> You need to capture n into the closure of the lambda: >> >> f = [lambda x, n=n: x+j for j in xrange(n)] > > You mean [lambda x, j=j: x+j for j in xrange(n)]
Ah, sorry, parentheses-problem. Diez -- http://mail.python.org/mailman/listinfo/python-list