If I make two lists of functions:
def makeFun(i): return lambda: i a = [makeFun(i) for i in range(10)] b = [lambda: i for i in range(10)]
Lambdas in python share the variable scope they're created in. In your first case, the scope of the lambda is makeFun's. In your second case, it's the global i, which is 9 because it's a leftover from the loop.
i
That's what I understand of it anyway...