[Python-ideas] An ABC representing "Iterable, Sized, Container"

Nick Coghlan ncoghlan at gmail.com
Fri Jul 22 02:36:00 EDT 2016

On 22 July 2016 at 14:04, Guido van Rossum <guido at python.org> wrote:
> If it really must be two words, how about SizedIterable? That suggests
> it's a subclass of Sized and Iterable, which it is. Container doesn't
> need separate mention, it's pretty obvious that any Iterable can
> implement __contains__, and more people know that Iterable is an ABC
> than Container.

SizedIterable works for me, as it's the __len__ that drives most of
the other interesting properties beyond an arbitrary iterable (like
using iteration for the default containment check without worrying
about consuming a one-shot iterator or creating an infinite loop).


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list