Arnaud Delobelle wrote: > "Diez B. Roggisch" <deets at 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