简体   繁体   中英

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 Python 2 :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM