Vedran Čačić <ved...@gmail.com> added the comment: Why exactly is [2,3] expected? In the first example, the inner list has two functions that are _exactly the same_. Each of them takes a, grabs i from outer scope, and returns a[i]. (And of course, at the moment of evaluation of these functions, i is 1.)
Do you really expect i to be "spliced" into the lambda as a value at the moment of constructing the function? Would you also expect lambda x: x + input('y? ') to ask you for input? ---------- nosy: +veky _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38933> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com