[issue47028] Incorrect behaviour when zipping a bunch of maps

2022-03-15 Thread Dennis Sweeney
Dennis Sweeney added the comment: https://bugs.python.org/issue45469 is similar. Thanks for the report, but I'll go ahead and close this. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker

[issue47028] Incorrect behaviour when zipping a bunch of maps

2022-03-15 Thread Dennis Sweeney
Dennis Sweeney added the comment: There's an FAQ entry here: https://docs.python.org/3/faq/programming.html#why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result -- ___ Python tracker

[issue47028] Incorrect behaviour when zipping a bunch of maps

2022-03-15 Thread Dennis Sweeney
Dennis Sweeney added the comment: This is because i is not captured by the function definition. `lambda x: x**i` always makes the "input to the ith power" function, never the "input to the 3rd power" function, even if i happens to be 3 right now. Consider replacing `lambda x: x**i` with `lam

[issue47028] Incorrect behaviour when zipping a bunch of maps

2022-03-15 Thread John K.
New submission from John K. : map(f, itr) is supposed to be the lazy way to do [f(val) for val in itr]. However, when unpacking and zipping a list of maps, I get a different result from when evaluating eagerly. More precisely: Python 3.10.2 | packaged by conda-forge | (main, Mar 8 2022, 15:5