GH-98363: Add itertools.batched() by rhettinger · Pull Request #98364 · python/cpython
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with adding this, just a few small comments.
🤖 New build scheduled with the buildbot fleet by @rhettinger for commit b9cbb46 🤖
If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.
| Roughly equivalent to:: | ||
|
|
||
| def batched(iterable, n): | ||
| # batched('ABCDEFG', 3) --> ABC DEF G |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe tweak the example so it cannot be misunderstood as "return 3 batches"?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # batched('ABCDEFG', 3) --> ABC DEF G | |
| # list(batched('ABCDEFG', 3)) --> [['A', 'B', 'C'], ['D', 'E', 'F'], ['G']] |
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