什么是 )的成本len个(
功能Python的内置插件? (列表/元组/串/字典)
What is the cost of len()
function for Python built-ins? (list/tuple/string/dictionary)
这是 O(1)(非常快)你所提到的每一种类型,加上设置
和其他如 array.array
。
It's O(1) (very fast) on every type you've mentioned, plus set
and others such as array.array
.