Nir Friedman added the comment:
Wouldn't a nicer resolution for this be to change `iter` (which effectively
defines what is "iterable"), so that if `iter` does not find the `__iter__` or
sequence protocol, it then looks for the iterator protocol (`__next__`), and if
it finds that, return the argument?
In that way, all iterators would automatically get the sane implementation of
`__iter__` by default, and we could say that in the "runtime", all iterators
are iterable, matching the types. And people wouldn't need to implement
`__iter__` any more on their iterators i.e. the recommendation could simply be
dropped).
--
nosy: +quicknir
___
Python tracker
<https://bugs.python.org/issue45250>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com