[issue19362] Documentation for len() fails to mention that it works on sets

Ezio Melotti report at bugs.python.org
Sun Nov 17 01:07:34 CET 2013


Ezio Melotti added the comment:

I think it's better to do:
-Return the number of items of a sequence or mapping.
+Return the number of items of a sequence or container.

While it's true that most sequences are clearly containers (e.g. lists), the same is not so evident for other types like bytes or strings.
I'm also starting from the assumption that people reading the docstring of len just started with Python or programming in general, so it's more important to keep it simple and understandable rather than being 100% accurate.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19362>
_______________________________________


More information about the Python-bugs-list mailing list