Message405330
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). |
|
Date |
User |
Action |
Args |
2021-10-29 19:22:28 | quicknir | set | recipients:
+ quicknir, brett.cannon, srittau |
2021-10-29 19:22:28 | quicknir | set | messageid: <1635535348.02.0.60875743204.issue45250@roundup.psfhosted.org> |
2021-10-29 19:22:28 | quicknir | link | issue45250 messages |
2021-10-29 19:22:27 | quicknir | create | |
|