3 ms·
Python Ruby map collect,map lambda block filter select ? reject
by wooby 17y ago
Python Ruby
map collect,map
lambda block
filter select
? reject
reduce (functools) inject (native)
Guido van Rossum on inclusion of 'reduce' in Python 3.0, in 2005:
"This is actually the one I've always hated most, because, apart from a few examples involving + or *, almost every time I see a reduce() call with a non-trivial function argument, I need to grab pen and paper to diagram what's actually being fed into that function before I understand what the reduce() is supposed to do. So in my mind, the applicability of reduce() is pretty much limited to associative operators, and in all other cases it's better to write out the accumulation loop explicitly" (http://www.artima.com/weblogs/viewpost.jsp?thread=98196 http://www.artima.com/weblogs/viewpost.jsp?thread=98196)
Ruby lets you do it however you want to. I don't see myself learning Python any time soon.