[docs] [issue18558] Iterable glossary entry needs clarification

Raymond Hettinger report at bugs.python.org
Mon Jul 17 10:30:24 EDT 2017


Raymond Hettinger added the comment:

The wold "iterable" just means "can be looped over".  There are many ways to implement this capability (two-arg form of iter(), the __iter__ method, generators, __getitem__ with integer indexing, etc).

collections.abc.Iterable is more limited and that is okay.  There is nothing that compels us to break an API has been around and successful for 26+ years.  That clearly wasn't Guido's intention when he added  collections.abc.Iterable which is just a building block for more complex ABCs.

I recommend closing this.  We're not going to kill a useful API and break tons of code because of an overly pedantic reading of what is allowed to be iterable.

However we can make a minor amendment to the glossary entry to mention that there are multiple ways of becoming iterable.

Stephen, the try/except is a reasonable way to recognize an iterable.  The ABCs are intended to recognize only things that implement a particular implementation or that are registered.  It is not more encompassing or normative than that.

----------
assignee: docs at python -> rhettinger
nosy: +rhettinger
versions: +Python 3.7 -Python 3.3, Python 3.4

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


More information about the docs mailing list