This is the standard behaviour of closures in Python. It's annoying, and often not what you expect, but it's not a bug. Effectively, your dict or list contains five functions, each of which refer to the same variable "t". By the time the loop finishes, that variable has the value 4, so naturally all five functions see the same value for t. The standard work-around is to use the default-argument trick to take a snapshot of the current value of the variable at the moment the function is created: [(lambda x, t=t: x * t) for t in range(5)]
For Python 3 you can also make it a keyword-only argument by adding a bare '*' to the parameter list: funcs = [(lambda x, *, t=t: x * t) for t in range(5)] Code that accidentally calls funcs[0](3, 'silent bug ') will raise a TypeError because "t" can only be passed as a keyword argument. An alternative is to use another lambda instead of using a default argument: funcs = [(lambda y: (lambda x: x * y))(t) for t in range(5)] This lets you continue to use a closure (now over the temporary scope of the outer call) and keep the function signature free of extra arguments. However, using a keyword-only argument is obviously less obfuscated.