https://github.com/python/cpython/commit/4a33fe59f78aa916b7c65cd76c0dda6c561a8493
commit: 4a33fe59f78aa916b7c65cd76c0dda6c561a8493
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: rhettinger <[email protected]>
date: 2026-01-10T22:19:15-06:00
summary:
[3.14] Sync the batched() example with the grouper() example. (gh-143676)
(gh-143678)
files:
M Doc/library/itertools.rst
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 0bc9b933d89227..e28d139c76e0c8 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -47,7 +47,7 @@ Iterator Arguments Results
Iterator Arguments Results
Example
============================ ============================
=================================================
=============================================================
:func:`accumulate` p [,func] p0, p0+p1,
p0+p1+p2, ... ``accumulate([1,2,3,4,5]) → 1 3 6 10
15``
-:func:`batched` p, n (p0, p1, ...,
p_n-1), ... ``batched('ABCDEFG', n=2) → AB CD EF G``
+:func:`batched` p, n (p0, p1, ...,
p_n-1), ... ``batched('ABCDEFG', n=3) → ABC DEF G``
:func:`chain` p, q, ... p0, p1, ...
plast, q0, q1, ... ``chain('ABC', 'DEF') → A B C D E F``
:func:`chain.from_iterable` iterable p0, p1, ...
plast, q0, q1, ... ``chain.from_iterable(['ABC', 'DEF']) →
A B C D E F``
:func:`compress` data, selectors (d[0] if
s[0]), (d[1] if s[1]), ... ``compress('ABCDEF', [1,0,1,0,1,1])
→ A C E F``
@@ -181,7 +181,7 @@ loops that truncate the stream.
Roughly equivalent to::
def batched(iterable, n, *, strict=False):
- # batched('ABCDEFG', 2) → AB CD EF G
+ # batched('ABCDEFG', 3) → ABC DEF G
if n < 1:
raise ValueError('n must be at least one')
iterator = iter(iterable)
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]