News for hackers. Stuff that matters.
Re:The Zen of Python by Example by KirinDave on Thursday February 10, 2011 @08:36PM (#2204768)
The link for the thread: http://artifex.org/~hblanks/talks/2011/pep20_by_example.py.t...

It does indeed mention a lambda in the very first example, if only as a competition with list comprehension syntax. But even Python's list comprehensions look a little dated now.

Re:The Zen of Python by Example by eru on Friday February 11, 2011 @06:23AM (#2205935)
Python's list comprehension is actually inspired by Haskell (or was it the other way around)?

What do you mean by dated? What new ideas have come up for List comprehension syntax?

(I agree that Lambda should be call fun or fn or \. An implicit _ might also work, though that's somewhat against Python's spirit---c.f. the explicit self in methods.)

Re:The Zen of Python by Example by sausagefeet on Friday February 11, 2011 @10:17AM (#2206548)
Like most good ideas, it came from Haskell :)

The part that bothers me about the list comprehension section is that conflating list comprehension and lambda. Is it telling me that list comprehension is better than map/filter or better than lambda? I don't know. Quiet honestly, in many situations I find:

halves_evens = lambda nums : [i/2 for i in nums if nums % 2 == 0]

to be the cleanest.