簡體   English   中英

Python的內置reduce和functools.reduce有何不同?

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

兩者都有完全相同的文檔,在我看來,兩者都來自https://hg.python.org/cpython/file/Modules/_functoolsmodule.c中的相同源代碼。

但是,我不確定。 我沒有在CPython的源代碼中找到任何其他引用。 有人可以在這里闡明一些嗎?

根據Python 2中functools.reduce的文檔

這與reduce()功能相同。 它在此模塊中可用,以允許編寫與Python 3更向前兼容的代碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM