相关疑难解决方法(0)

Python的reduce()短路吗?

如果我做:

result = reduce(operator.and_, [False] * 1000)
Run Code Online (Sandbox Code Playgroud)

第一次结果后它会停止吗?(自False & anything == False)

同理:

result = reduce(operator.or_, [True] * 1000)
Run Code Online (Sandbox Code Playgroud)

python

13
推荐指数
2
解决办法
1911
查看次数

标签 统计

python ×1