[英]Python functools.reduce, how to reduce a list a return a new one
[英]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.