This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author quicknir
Recipients brett.cannon, quicknir, srittau
Date 2021-10-29.19:22:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1635535348.02.0.60875743204.issue45250@roundup.psfhosted.org>
In-reply-to
Content
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).
History
Date User Action Args
2021-10-29 19:22:28quicknirsetrecipients: + quicknir, brett.cannon, srittau
2021-10-29 19:22:28quicknirsetmessageid: <1635535348.02.0.60875743204.issue45250@roundup.psfhosted.org>
2021-10-29 19:22:28quicknirlinkissue45250 messages
2021-10-29 19:22:27quicknircreate