]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] Docs: Improve example for ``itertools.batched()`` (GH-136775) (#136779)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 19 Jul 2025 09:35:48 +0000 (11:35 +0200)
committerGitHub <noreply@github.com>
Sat, 19 Jul 2025 09:35:48 +0000 (09:35 +0000)
commit96fac51a211b0adabc798d0921b53c276b9d83a2
treed136322812b39daf77bc43aea1a84c3d715f62b2
parent0936a53b033fcd87bdc07dba9aa2cb18b7e3935a
[3.13] Docs: Improve example for ``itertools.batched()`` (GH-136775) (#136779)

Docs: Improve example for ``itertools.batched()`` (GH-136775)

The current example `batched('ABCDEFG', n=3) → ABC DEF G` can confuse readers because both, the size of the tuples and the number of tuples are 3.
By using a batch size of n=2, it is clearer that the `n` argument refers to the size of the resulting tuples.
I.e. the new example is: `batched('ABCDEFG', n=2) → AB CD EF G`
(cherry picked from commit 3eecc72ac70943f7e33297eea17803af15322c88)

Co-authored-by: RafaelWO <38643099+RafaelWO@users.noreply.github.com>
Doc/library/itertools.rst