4 ms·
Python's Functional Training Wheels
- goldmab 15y agoI disagree with map/filter/reduce being "key" in Python. I've been writing Python for a long time and I never use them. Comprehensions are more pythonic than map+filter, and reduce just doesn't come up. Here's Guido explaining why he wanted to move all three functions out of builtins in Python 3: http://www.artima.com/weblogs/viewpost.jsp?thread=98196 http://www.artima.com/weblogs/viewpost.jsp?thread=98196
- ithayer 15y agoMy intent there was not to say that they are key in python, but rather in more functional languages. Yet another reason I worry that Python 3 may fracture the community...
- goldmab 15y agoReduce got banished to functools, but map and filter are still around. So people can process collections using the lispy style if they like. I just hope they realize that it's only a difference in style.
- StavrosK 15y agoI don't see why, list comprehensions have superseded map and filter and I don't see them as anything other than a more readable version of them...
- ericmoritz 15y agoreduce() is a handy function. I agree that map and filter could be replaced easily with list comprehensions. I personally find list comprehensions to be more explicit and easier to read.