Message298530
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. |
|
Date |
User |
Action |
Args |
2017-07-17 14:30:24 | rhettinger | set | recipients:
+ rhettinger, terry.reedy, r.david.murray, Zero, docs@python, veky |
2017-07-17 14:30:24 | rhettinger | set | messageid: <1500301824.6.0.704360364517.issue18558@psf.upfronthosting.co.za> |
2017-07-17 14:30:24 | rhettinger | link | issue18558 messages |
2017-07-17 14:30:24 | rhettinger | create | |
|