-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure documentation is accurate for what an (async) iterable and (async) iterator are #89413
Comments
There's some inaccuracies when it comes to iterable and iterators (async and not). See https://mail.python.org/archives/list/python-dev@python.org/thread/3W7TDX5KNVQVGT5CUHBK33M7VNTP25DZ/#3W7TDX5KNVQVGT5CUHBK33M7VNTP25DZ for background. Should probably check:
This applies to iter()/iter/iterable, next()/next/iterator, and their async equivalents. |
One thing I would strongly suggest for consistent terminology: Make "iterator" mean an object that has both "__next()" and "__iter()". This is consistent with how an iterator has been described in the glossary for a long time, but also consistent with (abc.collections|typing).Iterator. Either invent a different term for objects having "__next__()" (but not necessarily "__iter__()"), or use a description like "an iterator or any other object that has a __next__() method". |
The point of this issue, though, is to not make that claim as it's inaccurate. |
I also need to leave a comment on python/typeshed#6030 if/when this is fixed. |
Wouldn't a nicer resolution for this be to change In that way, all iterators would automatically get the sane implementation of |
Unfortunately that isn't backwards-compatible. Some people may explicitly want their iterators to not be iterables to guarantee that people who want an iterator get a fresh/new one instead of reusing a live iterator. |
Okay, fair enough. |
__iter__
and iterators being inconsistently required by CPython #29170__iter__
and iterators being inconsistently required by CPython (GH-29170) #29650Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: