News for hackers. Stuff that matters.
Re:Dear Python by metamemetics on Tuesday February 02, 2010 @08:52PM (#1096835)
In regards to the complaint on lambda, isn't it more pythonic to use list comprehensions anyway?

intlist=range(0,16)

filter(lambda x: x % 3 == 0, intlist)

vs.

[x for x in intlist if x % 3 == 0]

Should be faster too: http://stackoverflow.com/questions/1247486/python-list-compr...

I know anonymous functions are idiomatic in javascript from using jquery, but I rarely use them in python. Does anyone have a good example of leveraging lambda in python?

There are no comments on this comment yet.