Oz123 Oz123 - 1 year ago 92
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download