user1804599
user1804599

Reputation:

What is "module" in the docstring of len?

>>> 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)

Notice the two parameters in the first line of the docstring.

When would you pass two arguments to len? Is the docstring incorrect? I'm using Python 3.4.0.

Upvotes: 6

Views: 141

Answers (1)

Ffisegydd
Ffisegydd

Reputation: 53698

This was a bug submitted on 2014-04-18 here. It has since been fixed in 3.4.1.

Quoting Vedran Čačić, the original author of the bug report:

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.

Upvotes: 9

Related Questions