Oz123 Oz123 - 11 months ago 46
Python Question

How are Python's built-in reduce and functools.reduce different?

Both have exact same documentation, and it seems to me that both stem from same source code in https://hg.python.org/cpython/file/Modules/_functoolsmodule.c.

However, I am not sure about it. I didn't find any other refernces in the source code of CPython. Can some one shed some more light on this here?


Per the documentation of functools.reduce in python2:

This is the same function as reduce(). It is made available in this module to allow writing code more forward-compatible with Python 3.