-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
itertools doc: examples for groupby() and tee() #120618
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
Conversation
|
Thanks @ferdnyc for the PR, and @rhettinger for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
(cherry picked from commit 79e09e6) Co-authored-by: Frank Dana <[email protected]>
(cherry picked from commit 79e09e6) Co-authored-by: Frank Dana <[email protected]>
|
GH-120637 is a backport of this pull request to the 3.13 branch. |
|
GH-120638 is a backport of this pull request to the 3.12 branch. |
|
Thanks @ferdnyc for the PR, and @rhettinger for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Sorry, @ferdnyc and @rhettinger, I could not cleanly backport this to |
Since @rhettinger migrated the itertools examples to concise demonstrations in the table(s) of functions (back in 2009, commit 5bfd8ce),
groupby()andtee()have lacked examples of their function.While somewhat less revelatory than the other examples, concise illustrations of their purpose does seem possible. I feel that presenting examples has sufficient merit, particularly for less experienced developers, that it's worth attempting to do so. (Particularly because, in the case of
tee, I don't find the "Results"-column description particularly clear or explanatory.)These are my attempts at demonstrating the two tools via brief code snippets, in a manner similar to how all the other functions are documented. Like the other examples, the details of unpacking the returned iterators are glossed over, showing only the values ultimately produced.
📚 Documentation preview 📚: https://cpython-previews--120618.org.readthedocs.build/