Hacker News new | ask | show | jobs
by __alexs 1458 days ago
You what? https://docs.python.org/3/library/functools.html?highlight=r...
2 comments

No, he's right. It got 'demoted' from a core function to a footnote in a module. See also https://blog.finxter.com/about-guidos-fate-of-reduce-in-pyth...
No he's wrong. Python the language and Python the standard library are not separate things.
no I'm right

> 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.

https://www.artima.com/weblogs/viewpost.jsp?thread=98196

Grantparent is right. What you pointed to is in functools, a "functional" utility package in the stdlib, which has even more exotic stuff.

But Python doesn't have a reduce function as a primitive, and Guido and co discourage such uses. So much so, that Python 2 did have, and it was explicitly removed.