>>> print(len.__doc__)
len(module, object)
Return the number of items of a sequence or mapping.
>>> len(os, 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: len() takes exactly one argument (2 given)
Run Code Online (Sandbox Code Playgroud)
请注意docstring第一行中的两个参数.
你len
什么时候会传递两个参数?文档字符串不正确吗?我正在使用Python 3.4.0.
这是2014-04-18 在这里提交的错误.它已在3.4.1中修复.
引用臭虫报告的原作者VedranČačić:
From recently, help(len) gives the wrong signature of len.
Help on built-in function len in module builtins:
len(...)
len(module, object)
^^^^^^^^
Return the number of items of a sequence or mapping.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
116 次 |
最近记录: |