News for hackers. Stuff that matters.
Re:Python’s lambda is broken by d0mine on Thursday April 09, 2009 @02:25PM (#554868)
Ordinary Python function have the same behaviour due to Python has lexical scopes but dynamic namespaces.

   >>> def add(n):
   ...     return i + n
   ...
   >>> fs = [add for i in range(10)]
   >>> fs[3](4)
   13
This example works due to list-comprehension leaks `i` binding.

http://stackoverflow.com/questions/139819/why-results-of-map...

There are no comments on this comment yet.