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="")

4/17/2019 5:08:07 AM

Karsten Stiegler

2 Answers

New Answer




Thanks a lot! RTFM advice to me ... but the manuals are so long :)