|
|
|
|
|
by eru
996 days ago
|
|
In Python you are much more likely to hit that problem not with closures constructed with an explicit 'lambda', but with generator-comprehension expressions. (((i, j) for i in "abc") for j in range(3))
The values of the above depends on in which order you evaluate the whole thing.(Do take what I wrote with a grain of salt. Either the above is already a problem, or perhaps you also need to mix in list-comprehension expressions, too, to surface the bug.) |
|
Equivalents:
Late binding applies in both cases of course, but in the first case it doesn't matter, whereas in the latter case it matters.I think early binding would produce the same result in both cases.