https://github.com/python/cpython/commit/79e09e60d865b7b3fcde9ccee86a502da82bb2b3
commit: 79e09e60d865b7b3fcde9ccee86a502da82bb2b3
branch: main
author: Frank Dana <[email protected]>
committer: rhettinger <[email protected]>
date: 2024-06-17T08:19:14-05:00
summary:
itertools doc: examples for groupby() and tee() (#120618)
files:
M Doc/library/itertools.rst
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 3dc3f60923a0ba..1fdd00a69da1f3 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -58,12 +58,12 @@ Iterator Arguments
Results
: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``
:func:`dropwhile` predicate, seq seq[n],
seq[n+1], starting when predicate fails ``dropwhile(lambda x: x<5,
[1,4,6,3,8]) → 6 3 8``
:func:`filterfalse` predicate, seq elements of
seq where predicate(elem) fails ``filterfalse(lambda x: x<5,
[1,4,6,3,8]) → 6 8``
-:func:`groupby` iterable[, key] sub-iterators
grouped by value of key(v)
+:func:`groupby` iterable[, key] sub-iterators
grouped by value of key(v) ``groupby(['A','B','ABC'], len) → (1, A
B) (3, ABC)``
:func:`islice` seq, [start,] stop [, step] elements from
seq[start:stop:step] ``islice('ABCDEFG', 2, None) → C D E F G``
:func:`pairwise` iterable (p[0], p[1]),
(p[1], p[2]) ``pairwise('ABCDEFG') → AB BC CD DE EF
FG``
:func:`starmap` func, seq
func(\*seq[0]), func(\*seq[1]), ... ``starmap(pow, [(2,5),
(3,2), (10,3)]) → 32 9 1000``
:func:`takewhile` predicate, seq seq[0],
seq[1], until predicate fails ``takewhile(lambda x: x<5,
[1,4,6,3,8]) → 1 4``
-:func:`tee` it, n it1, it2, ...
itn splits one iterator into n
+:func:`tee` it, n it1, it2, ...
itn splits one iterator into n ``tee('ABC', 2) → A B C, A B C``
:func:`zip_longest` p, q, ... (p[0], q[0]),
(p[1], q[1]), ... ``zip_longest('ABCD', 'xy',
fillvalue='-') → Ax By C- D-``
============================ ============================
=================================================
=============================================================
_______________________________________________
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]