[Python-Dev] bool(container) [was bool(iter([])) changedbetween 2.3 and 2.4]

Raymond Hettinger raymond.hettinger at verizon.net
Fri Sep 30 18:25:01 CEST 2005

[Guido van Rossum]
> __len__ is for sequences and mappings specifically -- everything that
> supports __getitem__ should have __len__ and everything that has
> __len__ should have __getitem__.

That's going a bit far.  Unordered collections (like sets and bags) are
a good counter-example.


More information about the Python-Dev mailing list