What is a “module” in len pre-shrink?

>>> 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 will you pass two arguments to len ? Is the doxrine specified correctly? I am using Python 3.4.0.

+6
source share
1 answer

This was a bug submitted on 2014-04-18 here . Since then it has been fixed in 3.4.1.

Quote from Vedran Čačić, author of the original 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. 
+9
source

Source: https://habr.com/ru/post/977348/


All Articles