Re:Zed finishes Learn Python The Hard Way
by steveklabnik on Wednesday September 29, 2010 @09:59AM
(#1739402)
The Python community has frowned on functional programming, reduce isn't in basic Python anymore, and they almost took out lambda: http://www.artima.com/weblogs/viewpost.jsp?thread=98196
[ Parent
| on HN ]
Re:Zed finishes Learn Python The Hard Way
by RyanMcGreal on Wednesday September 29, 2010 @11:05AM
(#1739643)
Strange that they took out reduce() but not map() and filter(), which you can easily replicate with list comprehensions.
Re:Zed finishes Learn Python The Hard Way
by steveklabnik on Wednesday September 29, 2010 @11:37AM
(#1739783)
Yeah. The argument is based on reduce not being clear and easy to understand, which is frustrating to those of us who actually find map/reduce/filter to be more clear, not less.
Re:Zed finishes Learn Python The Hard Way
by ubernostrum on Thursday September 30, 2010 @06:11AM
(#1742797)
reduce isn't in basic Python anymore
It's in a module in the standard library, a module which contains a bunch of tools for working with higher-order functions. Or, in other words, if you've got a Python 3.x installed, you've got a reduce function available. The only difference is that it's no longer in the default global namespace (map and filter still are, of course).
This matches up pretty cleanly with my actual experience of writing Python; I've written a hell of a lot of Python code these past 6-7 years and so far as I can recall I've never used reduce.
(and if you want to get picky about this, keep in mind how much of Haskell requires import statements to get at -- moving less-commonly-used stuff into standard modules is not a bad thing at all)