News for hackers. Stuff that matters.
Re:Python’s lambda is broken by pavelludiq on Thursday April 09, 2009 @02:19PM (#554857)
Thanks for the clarification. I didn't know that until i started messing with them just now for my post.

Heres a a clearer example(you could deduce this from my previous post): >>> x=((lambda n: i + n) for i in range(10)) >>> y=((lambda i: lambda n: i + n)(i) for i in range(10)) >>> [f for f in x]==[i for i in y] True

this is with generators.

with list comprehensions it becomes: >>> x=[(lambda n: i + n) for i in range(10)] >>> y=[(lambda i: lambda n: i + n)(i) for i in range(10)] >>> [f for f in x]==[i for i in y] False

There are no comments on this comment yet.