【发布时间】:2017-07-29 20:28:11
【问题描述】:
在 Joel Grus 的 Data Science from Scratch 的第 2 章中,提供了以下示例:
all([ ]) # True, no falsy elements in the list
any([ ]) # False, no truthy elements in the list
根据 Grus 的说法,Python 将 [](一个空列表)视为“虚假”参数。那么为什么我们会根据 all() 或 any() 参数是否应用于空列表而得到不同的结果呢?
【问题讨论】:
标签: python