diff options
Diffstat (limited to 'Doc/library/itertools.rst')
-rw-r--r-- | Doc/library/itertools.rst | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 2b27647..96515111 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -74,7 +74,7 @@ loops that truncate the stream. .. function:: itertools.chain.from_iterable(iterable) - Alternate constructor for :func:`chain`. Gets chained inputs from a + Alternate constructor for :func:`chain`. Gets chained inputs from a single iterable argument that is evaluated lazily. Equivalent to:: @classmethod @@ -89,9 +89,9 @@ loops that truncate the stream. Return *r* length subsequences of elements from the input *iterable*. - Combinations are emitted in lexicographic sort order. So, if the + Combinations are emitted in lexicographic sort order. So, if the input *iterable* is sorted, the combination tuples will be produced - in sorted order. + in sorted order. Elements are treated as unique based on their position, not on their value. So if the input elements are unique, there will be no repeat @@ -306,12 +306,12 @@ loops that truncate the stream. Return successive *r* length permutations of elements in the *iterable*. If *r* is not specified or is ``None``, then *r* defaults to the length - of the *iterable* and all possible full-length permutations + of the *iterable* and all possible full-length permutations are generated. - Permutations are emitted in lexicographic sort order. So, if the + Permutations are emitted in lexicographic sort order. So, if the input *iterable* is sorted, the permutation tuples will be produced - in sorted order. + in sorted order. Elements are treated as unique based on their position, not on their value. So if the input elements are unique, there will be no repeat @@ -342,7 +342,7 @@ loops that truncate the stream. else: return - The code for :func:`permutations` can be also expressed as a subsequence of + The code for :func:`permutations` can be also expressed as a subsequence of :func:`product`, filtered to exclude entries with repeated elements (those from the same position in the input pool):: @@ -483,7 +483,7 @@ can be combined. >>> data = [ 1, 4,5,6, 10, 15,16,17,18, 22, 25,26,27,28] >>> for k, g in groupby(enumerate(data), lambda t:t[0]-t[1]): ... print(map(operator.itemgetter(1), g)) - ... + ... [1] [4, 5, 6] [10] @@ -610,7 +610,7 @@ which incur interpreter overhead. def unique_everseen(iterable, key=None): "List unique elements, preserving order. Remember all elements ever seen." # unique_everseen('AAAABBBCCDAABBB') --> A B C D - # unique_everseen('ABBCcAD', str.lower) --> A B C D + # unique_everseen('ABBCcAD', str.lower) --> A B C D seen = set() seen_add = seen.add if key is None: |