summaryrefslogtreecommitdiffstats
path: root/Doc/library/itertools.rst
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-04-17 10:48:31 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-04-17 10:48:31 (GMT)
commit5eaffc4ce1279cd023df68a6ee1fd1a5919bff2b (patch)
treefdb8535d3b3bf1cce46ddb07306562ca54f7ef48 /Doc/library/itertools.rst
parent967a83c4efdbd32f24763bc90afabcfe3d76f4b6 (diff)
downloadcpython-5eaffc4ce1279cd023df68a6ee1fd1a5919bff2b.zip
cpython-5eaffc4ce1279cd023df68a6ee1fd1a5919bff2b.tar.gz
cpython-5eaffc4ce1279cd023df68a6ee1fd1a5919bff2b.tar.bz2
Issue 2648: Add leading zero to money format recipe in the docs.
Diffstat (limited to 'Doc/library/itertools.rst')
-rw-r--r--Doc/library/itertools.rst14
1 files changed, 5 insertions, 9 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 4a4db29..7d7c6ca 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -98,7 +98,7 @@ loops that truncate the stream.
.. function:: combinations(iterable, r)
- Return successive *r* length combinations of elements in the *iterable*.
+ Return *r* length subsequences of elements from the input *iterable*.
Combinations are emitted in lexicographic sort order. So, if the
input *iterable* is sorted, the combination tuples will be produced
@@ -108,9 +108,6 @@ loops that truncate the stream.
value. So if the input elements are unique, there will be no repeat
values in each combination.
- Each result tuple is ordered to match the input order. So, every
- combination is a subsequence of the input *iterable*.
-
Equivalent to::
def combinations(iterable, r):
@@ -446,11 +443,10 @@ loops that truncate the stream.
Equivalent to nested for-loops in a generator expression. For example,
``product(A, B)`` returns the same as ``((x,y) for x in A for y in B)``.
- The leftmost iterators correspond to the outermost for-loop, so the output
- tuples cycle like an odometer (with the rightmost element changing on every
- iteration). This results in a lexicographic ordering so that if the
- inputs iterables are sorted, the product tuples are emitted
- in sorted order.
+ The nested loops cycle like an odometer with the rightmost element advancing
+ on every iteration. This pattern creats a lexicographic ordering so that if
+ the inputs iterables are sorted, the product tuples are emitted in sorted
+ order.
To compute the product of an iterable with itself, specify the number of
repetitions with the optional *repeat* keyword argument. For example,