任何非短路变体
reduce 在完全迭代完 iterable 之前不会终止迭代,因此它可用于创建非短路 any() 或 all() 函数:
import operator
# non short-circuit "all"
reduce(operator.and_, [False, True, True, True]) # = False
# non short-circuit "any"
reduce(operator.or_, [True, False, False, False]) # = True