[issue45930] Lambda function bug

2021-11-29 Thread Eric V. Smith
Change by Eric V. Smith : -- resolution: -> not a bug stage: -> resolved status: open -> closed type: -> behavior ___ Python tracker ___

[issue45930] Lambda function bug

2021-11-29 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: This is known behaviour due to binding. Please see https://docs.python.org/3/faq/programming.html#why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result -- nosy: +xtreak ___

[issue45930] Lambda function bug

2021-11-29 Thread Valery Lovchikov
New submission from Valery Lovchikov : Python 3.9.7 (default, Sep 10 2021, 14:59:43) [GCC 11.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> f=[lambda x: y**x for y in [2,3]] >>> f[0](2) 9 >>> f[1](2) 9 = I expected 4 as a result of f[0](2),