-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
gh-141004: Document remaining iterator types #141010
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
Merged
ZeroIntensity
merged 9 commits into
python:main
from
ZeroIntensity:document-missing-iterators
Nov 5, 2025
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cadfc16
Document PyByteArrayIter_Type
ZeroIntensity e4b2dad
Document PyBytesIter_Type
ZeroIntensity 2902970
Fix missing s.
ZeroIntensity 8d63104
Document PyListIter_Type, PyListRevIter_Type
ZeroIntensity c8fb023
Document PySetIter_Type
ZeroIntensity 1c2797f
Document PyTupleIter_Type
ZeroIntensity 0d06cce
Don't expose implementation details.
ZeroIntensity 69e4976
Fix newline thingy.
ZeroIntensity b2bc1d9
Update Doc/c-api/iterator.rst
ZeroIntensity File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would imply that all
bytearrayiterators have a single type, which would mean that no implementation of the C API can do the kind of optimization we did forrange.(Not too relevant for
bytearrayin particular, but you're adding the same docs for all the iterators.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you prefer that I remove the second sentence?
(I appreciate your feedback on these, by the way!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather find some dusty corner of the docs to stash all of these away in, with something like:
(We might want to add API to get a reverse iterator, just to discourage calling
PyReversed_Type->tp_newand such.)I think I'm sounding grumpy & terse, aren't I. Sorry! Going to sleep now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think it'd be better to keep these types close to their friends, but I'm open to convincing. As an alternative, would you be okay with adding a glossary term for "iterator type" or something like that, and then adding the warning there?
You're good :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's my view then.
I think these are implementation details that wouldn't be exposed today. Users are better off not using them (and not exposing their own iterator types).
Their docs should target people that found them in some code and want to understand them. They should show up in a search, and tell you how to replace the API, but they shouldn't be “advertised”.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I think I can get behind that. I've updated this PR to use the approach you suggested above. If we merge this, I'll remove the iterator types from the other PRs.