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

Antoine Pitrou report at bugs.python.org
Wed Oct 23 16:09:37 CEST 2013


Antoine Pitrou added the comment:

> Perhaps it would be better to say that "the argument may be any
> object with a __len__, such as the commonly used Python sequence and
> container types str, bytes, tuple, list, dict, and set".  After all,
> there are other built in types it works on as well: bytearray,
> frozenset, memoryview.

__len__ is an implementation detail for experts. Beginners don't need
to know about __len__ in order to understand querying the length of
a container. Similarly, they don't need to know about ABCs to understand,
intuitively, what a container is ;-)

----------
title: Documentation for len() fails to mention that it works on sets -> Documentation for len() fails to mention that it works	on sets

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


More information about the docs mailing list