Re:Origins of Python's “Functional” Features (2009)
by wheaties on Monday January 09, 2017 @09:04AM
(#13356334)
I never understood his desire to remove 'reduce' from Python. I would love to hear a cogent reason as to why we should have to write a for-loop for everything 'reduce' like. In other languages, 'reduce' (akin to 'fold' for non-Python people) is one of the things you reach for daily.
[ Parent
| on HN ]
Re:Origins of Python's “Functional” Features (2009)
by talideon on Monday January 09, 2017 @09:59AM
(#13356730)
The main issue is syntactic: Python's syntax is such that reduce() isn't terribly useful. If Python had an equivalent of blocks in Ruby or at least the ability to write non-trivial lambdas, I can see reduce() being useful, but as things stand, it's just kind of useless.
Re:Origins of Python's “Functional” Features (2009)
by d0mine on Monday January 09, 2017 @09:42AM
(#13356603)
It is still available as functools.reduce
An explicit loop is easier to read as a rule than the corresponding reduce() code. See http://stackoverflow.com/questions/15995/useful-code-which-u...