|
Re: The fate of reduce() in Python 3000
|
Posted: Apr 21, 2005 3:24 PM
|
|
List comprehensions seem nice for the most common cases, but I still think sometimes filter() and map() look cleaner.. particularly map() for some things.
Also, how do you cleanly achieve lists that are a function of multiple sequences with list comprehensions? How do you do this, for example:
>>> map(lambda x, y: (x, y, x*y), range(6), range(6)) [(0, 0, 0), (1, 1, 1), (2, 2, 4), (3, 3, 9), (4, 4, 16), (5, 5, 25)]
Oh yes, and lambda.. ouch. We need some kind of other syntax for anonymous functions, then--the event driven network programmers will be hung out to dry.
I wonder, because things like map(), filter(), and lambda are doing very good things for a lot of people, and they cause no significant harm to those who don't use them, what's the benefit of removing them?
Especially with things like partial application coming through the door...
map(partial(math.pow, 2), seq)
Python has always been a great place to scratch little functional itches when they seem appropriate...
|
|