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@python -> rhettinger
nosy: +rhettinger
versions: +Python 3.7 -Python 3.3, Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18558>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to