lambda function don’t closure the parameter in Python? [duplicate]

you need to do:

lambda i=i: pprint(i)

instead to capture the current value of i

Leave a Comment