gpt4 book ai didi

python - Python2 的内置 reduce 和 functools.reduce 有何不同?

转载 作者:太空狗 更新时间:2023-10-30 02:02:58 25 4
gpt4 key购买 nike

两者都有完全相同的文档,在我看来它们都源于 https://hg.python.org/cpython/file/Modules/_functoolsmodule.c 中的相同源代码.

但是,我不确定。我没有在 CPython 的源代码中找到任何其他引用。有人可以在这里进一步说明这一点吗?

最佳答案

根据 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.

关于python - Python2 的内置 reduce 和 functools.reduce 有何不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36972021/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com