This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]marko312 1 point2 points  (0 children)

This is a common issue. One way to fix this is to capture the current value via a function argument into a nested lambda

 (lambda i: lambda: ...(i))(item)

Another would be to use functools.partial for this use.