Skip to content

Commit 175cb23

Browse files
committed
Clarify the table entries for combinatorics.
1 parent bf1537c commit 175cb23

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

Doc/library/itertools.rst

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,19 @@ operator can be mapped across two vectors to form an efficient dot-product:
6161

6262
**Combinatoric generators:**
6363

64-
===================================== ==================== =================================================
65-
Iterator Arguments Results
66-
===================================== ==================== =================================================
67-
:func:`product` p, q, ... [repeat=1] cartesian product
68-
:func:`permutations` p[, r] r-length permutations (without repeated elements)
69-
:func:`combinations` p[, r] r-length combinations (sorted and no repeats)
70-
:func:`combinations_with_replacement` p[, r] r-length combinations (sorted but with repeats)
71-
===================================== ==================== =================================================
64+
============================================== ==================== =============================================================
65+
Iterator Arguments Results
66+
============================================== ==================== =============================================================
67+
:func:`product` p, q, ... [repeat=1] cartesian product, equivalent to a nested for-loop
68+
:func:`permutations` p[, r] r-length tuples, all possible orderings, no repeated elements
69+
:func:`combinations` p[, r] r-length tuples, in sorted order, no repeated elements
70+
:func:`combinations_with_replacement` p[, r] r-length tuples, in sorted order, with repeated elements
71+
|
72+
``product('ABCD', repeat=2)`` ``AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD``
73+
``permutations('ABCD', 2)`` ``AB AC AD BA BC BD CA CB CD DA DB DC``
74+
``combinations('ABCD', 2)`` ``AB AC AD BC BD CD``
75+
``combinations_with_replacement('ABCD', 2)`` ``AA AB AC AD BB BC BD CC CD DD``
76+
============================================== ==================== =============================================================
7277

7378

7479
.. _itertools-functions:

0 commit comments

Comments
 (0)