0
Lambda question
why does this code prints 666? The function returns a lambda function or actually it returns 3 functions (due to the range?). When I then pass 3 as an argument - what happens? As simple as this looks I don’t get it yet. def ll(): return [lambda x:i*x for i in range(3)] for l in ll(): print(l(3), end="")
2 ответов
+ 2
https://docs.python.org/3/faq/programming.html#why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result
+ 1
Thanks a lot! RTFM advice to me ... but the manuals are so long :)