forked from AFPy/python-docs-fr
772 lines
25 KiB
Plaintext
772 lines
25 KiB
Plaintext
# SOME DESCRIPTIVE TITLE.
|
|
# Copyright (C) 2001-2016, Python Software Foundation
|
|
# This file is distributed under the same license as the Python package.
|
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
#
|
|
#, fuzzy
|
|
msgid ""
|
|
msgstr ""
|
|
"Project-Id-Version: Python 3.6\n"
|
|
"Report-Msgid-Bugs-To: \n"
|
|
"POT-Creation-Date: 2017-04-02 22:11+0200\n"
|
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
"Language: fr\n"
|
|
"MIME-Version: 1.0\n"
|
|
"Content-Type: text/plain; charset=UTF-8\n"
|
|
"Content-Transfer-Encoding: 8bit\n"
|
|
|
|
#: ../Doc/library/itertools.rst:2
|
|
msgid ":mod:`itertools` --- Functions creating iterators for efficient looping"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:16
|
|
msgid ""
|
|
"This module implements a number of :term:`iterator` building blocks inspired "
|
|
"by constructs from APL, Haskell, and SML. Each has been recast in a form "
|
|
"suitable for Python."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:20
|
|
msgid ""
|
|
"The module standardizes a core set of fast, memory efficient tools that are "
|
|
"useful by themselves or in combination. Together, they form an \"iterator "
|
|
"algebra\" making it possible to construct specialized tools succinctly and "
|
|
"efficiently in pure Python."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:25
|
|
msgid ""
|
|
"For instance, SML provides a tabulation tool: ``tabulate(f)`` which produces "
|
|
"a sequence ``f(0), f(1), ...``. The same effect can be achieved in Python "
|
|
"by combining :func:`map` and :func:`count` to form ``map(f, count())``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:29
|
|
msgid ""
|
|
"These tools and their built-in counterparts also work well with the high-"
|
|
"speed functions in the :mod:`operator` module. For example, the "
|
|
"multiplication operator can be mapped across two vectors to form an "
|
|
"efficient dot-product: ``sum(map(operator.mul, vector1, vector2))``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:35
|
|
msgid "**Infinite Iterators:**"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:38 ../Doc/library/itertools.rst:48
|
|
#: ../Doc/library/itertools.rst:67
|
|
msgid "Iterator"
|
|
msgstr "Itérateur"
|
|
|
|
#: ../Doc/library/itertools.rst:38 ../Doc/library/itertools.rst:48
|
|
#: ../Doc/library/itertools.rst:67
|
|
msgid "Arguments"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:38 ../Doc/library/itertools.rst:48
|
|
#: ../Doc/library/itertools.rst:67
|
|
msgid "Results"
|
|
msgstr "Résultats"
|
|
|
|
#: ../Doc/library/itertools.rst:38 ../Doc/library/itertools.rst:48
|
|
msgid "Example"
|
|
msgstr "Exemple"
|
|
|
|
#: ../Doc/library/itertools.rst:40
|
|
msgid ":func:`count`"
|
|
msgstr ":func:`count`"
|
|
|
|
#: ../Doc/library/itertools.rst:40
|
|
msgid "start, [step]"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:40
|
|
msgid "start, start+step, start+2*step, ..."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:40
|
|
msgid "``count(10) --> 10 11 12 13 14 ...``"
|
|
msgstr "``count(10) --> 10 11 12 13 14 ...``"
|
|
|
|
#: ../Doc/library/itertools.rst:41
|
|
msgid ":func:`cycle`"
|
|
msgstr ":func:`cycle`"
|
|
|
|
#: ../Doc/library/itertools.rst:41
|
|
msgid "p"
|
|
msgstr "p"
|
|
|
|
#: ../Doc/library/itertools.rst:41
|
|
msgid "p0, p1, ... plast, p0, p1, ..."
|
|
msgstr "p0, p1, ... plast, p0, p1, ..."
|
|
|
|
#: ../Doc/library/itertools.rst:41
|
|
msgid "``cycle('ABCD') --> A B C D A B C D ...``"
|
|
msgstr "``cycle('ABCD') --> A B C D A B C D ...``"
|
|
|
|
#: ../Doc/library/itertools.rst:42
|
|
msgid ":func:`repeat`"
|
|
msgstr ":func:`repeat`"
|
|
|
|
#: ../Doc/library/itertools.rst:42
|
|
msgid "elem [,n]"
|
|
msgstr "elem [,n]"
|
|
|
|
#: ../Doc/library/itertools.rst:42
|
|
msgid "elem, elem, elem, ... endlessly or up to n times"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:42
|
|
msgid "``repeat(10, 3) --> 10 10 10``"
|
|
msgstr "``repeat(10, 3) --> 10 10 10``"
|
|
|
|
#: ../Doc/library/itertools.rst:45
|
|
msgid "**Iterators terminating on the shortest input sequence:**"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:50
|
|
msgid ":func:`accumulate`"
|
|
msgstr ":func:`accumulate`"
|
|
|
|
#: ../Doc/library/itertools.rst:50
|
|
msgid "p [,func]"
|
|
msgstr "p [,func]"
|
|
|
|
#: ../Doc/library/itertools.rst:50
|
|
msgid "p0, p0+p1, p0+p1+p2, ..."
|
|
msgstr "p0, p0+p1, p0+p1+p2, ..."
|
|
|
|
#: ../Doc/library/itertools.rst:50
|
|
msgid "``accumulate([1,2,3,4,5]) --> 1 3 6 10 15``"
|
|
msgstr "``accumulate([1,2,3,4,5]) --> 1 3 6 10 15``"
|
|
|
|
#: ../Doc/library/itertools.rst:51
|
|
msgid ":func:`chain`"
|
|
msgstr ":func:`chain`"
|
|
|
|
#: ../Doc/library/itertools.rst:51 ../Doc/library/itertools.rst:61
|
|
msgid "p, q, ..."
|
|
msgstr "p, q, ..."
|
|
|
|
#: ../Doc/library/itertools.rst:51 ../Doc/library/itertools.rst:52
|
|
msgid "p0, p1, ... plast, q0, q1, ..."
|
|
msgstr "p0, p1, ... plast, q0, q1, ..."
|
|
|
|
#: ../Doc/library/itertools.rst:51
|
|
msgid "``chain('ABC', 'DEF') --> A B C D E F``"
|
|
msgstr "``chain('ABC', 'DEF') --> A B C D E F``"
|
|
|
|
#: ../Doc/library/itertools.rst:52
|
|
msgid ":func:`chain.from_iterable`"
|
|
msgstr ":func:`chain.from_iterable`"
|
|
|
|
#: ../Doc/library/itertools.rst:52
|
|
msgid "iterable"
|
|
msgstr "itérable"
|
|
|
|
#: ../Doc/library/itertools.rst:52
|
|
msgid "``chain.from_iterable(['ABC', 'DEF']) --> A B C D E F``"
|
|
msgstr "``chain.from_iterable(['ABC', 'DEF']) --> A B C D E F``"
|
|
|
|
#: ../Doc/library/itertools.rst:53
|
|
msgid ":func:`compress`"
|
|
msgstr ":func:`compress`"
|
|
|
|
#: ../Doc/library/itertools.rst:53
|
|
msgid "data, selectors"
|
|
msgstr "data, selectors"
|
|
|
|
#: ../Doc/library/itertools.rst:53
|
|
msgid "(d[0] if s[0]), (d[1] if s[1]), ..."
|
|
msgstr "(d[0] if s[0]), (d[1] if s[1]), ..."
|
|
|
|
#: ../Doc/library/itertools.rst:53
|
|
msgid "``compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F``"
|
|
msgstr "``compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F``"
|
|
|
|
#: ../Doc/library/itertools.rst:54
|
|
msgid ":func:`dropwhile`"
|
|
msgstr ":func:`dropwhile`"
|
|
|
|
#: ../Doc/library/itertools.rst:54 ../Doc/library/itertools.rst:55
|
|
#: ../Doc/library/itertools.rst:59
|
|
msgid "pred, seq"
|
|
msgstr "pred, seq"
|
|
|
|
#: ../Doc/library/itertools.rst:54
|
|
msgid "seq[n], seq[n+1], starting when pred fails"
|
|
msgstr "seq[n], seq[n+1], starting when pred fails"
|
|
|
|
#: ../Doc/library/itertools.rst:54
|
|
msgid "``dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1``"
|
|
msgstr "``dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1``"
|
|
|
|
#: ../Doc/library/itertools.rst:55
|
|
msgid ":func:`filterfalse`"
|
|
msgstr ":func:`filterfalse`"
|
|
|
|
#: ../Doc/library/itertools.rst:55
|
|
msgid "elements of seq where pred(elem) is false"
|
|
msgstr " of seq where pred(elem) is false"
|
|
|
|
#: ../Doc/library/itertools.rst:55
|
|
msgid "``filterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8``"
|
|
msgstr "``filterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8``"
|
|
|
|
#: ../Doc/library/itertools.rst:56
|
|
msgid ":func:`groupby`"
|
|
msgstr ":func:`groupby`"
|
|
|
|
#: ../Doc/library/itertools.rst:56
|
|
msgid "iterable[, keyfunc]"
|
|
msgstr "iterable[, keyfunc]"
|
|
|
|
#: ../Doc/library/itertools.rst:56
|
|
msgid "sub-iterators grouped by value of keyfunc(v)"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:57
|
|
msgid ":func:`islice`"
|
|
msgstr ":func:`islice`"
|
|
|
|
#: ../Doc/library/itertools.rst:57
|
|
msgid "seq, [start,] stop [, step]"
|
|
msgstr "seq, [start,] stop [, step]"
|
|
|
|
#: ../Doc/library/itertools.rst:57
|
|
msgid "elements from seq[start:stop:step]"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:57
|
|
msgid "``islice('ABCDEFG', 2, None) --> C D E F G``"
|
|
msgstr "``islice('ABCDEFG', 2, None) --> C D E F G``"
|
|
|
|
#: ../Doc/library/itertools.rst:58
|
|
msgid ":func:`starmap`"
|
|
msgstr ":func:`starmap`"
|
|
|
|
#: ../Doc/library/itertools.rst:58
|
|
msgid "func, seq"
|
|
msgstr "func, seq"
|
|
|
|
#: ../Doc/library/itertools.rst:58
|
|
msgid "func(\\*seq[0]), func(\\*seq[1]), ..."
|
|
msgstr "func(\\*seq[0]), func(\\*seq[1]), ..."
|
|
|
|
#: ../Doc/library/itertools.rst:58
|
|
msgid "``starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000``"
|
|
msgstr "``starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000``"
|
|
|
|
#: ../Doc/library/itertools.rst:59
|
|
msgid ":func:`takewhile`"
|
|
msgstr ":func:`takewhile`"
|
|
|
|
#: ../Doc/library/itertools.rst:59
|
|
msgid "seq[0], seq[1], until pred fails"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:59
|
|
msgid "``takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4``"
|
|
msgstr "``takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4``"
|
|
|
|
#: ../Doc/library/itertools.rst:60
|
|
msgid ":func:`tee`"
|
|
msgstr ":func:`tee`"
|
|
|
|
#: ../Doc/library/itertools.rst:60
|
|
msgid "it, n"
|
|
msgstr "it, n"
|
|
|
|
#: ../Doc/library/itertools.rst:60
|
|
msgid "it1, it2, ... itn splits one iterator into n"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:61
|
|
msgid ":func:`zip_longest`"
|
|
msgstr ":func:`zip_longest`"
|
|
|
|
#: ../Doc/library/itertools.rst:61
|
|
msgid "(p[0], q[0]), (p[1], q[1]), ..."
|
|
msgstr "(p[0], q[0]), (p[1], q[1]), ..."
|
|
|
|
#: ../Doc/library/itertools.rst:61
|
|
msgid "``zip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-``"
|
|
msgstr "``zip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-``"
|
|
|
|
#: ../Doc/library/itertools.rst:64
|
|
msgid "**Combinatoric generators:**"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:69
|
|
msgid ":func:`product`"
|
|
msgstr ":func:`product`"
|
|
|
|
#: ../Doc/library/itertools.rst:69
|
|
msgid "p, q, ... [repeat=1]"
|
|
msgstr "p, q, ... [repeat=1]"
|
|
|
|
#: ../Doc/library/itertools.rst:69
|
|
msgid "cartesian product, equivalent to a nested for-loop"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:70
|
|
msgid ":func:`permutations`"
|
|
msgstr ":func:`permutations`"
|
|
|
|
#: ../Doc/library/itertools.rst:70
|
|
msgid "p[, r]"
|
|
msgstr "p[, r]"
|
|
|
|
#: ../Doc/library/itertools.rst:70
|
|
msgid "r-length tuples, all possible orderings, no repeated elements"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:71
|
|
msgid ":func:`combinations`"
|
|
msgstr ":func:`combinations`"
|
|
|
|
#: ../Doc/library/itertools.rst:71 ../Doc/library/itertools.rst:72
|
|
msgid "p, r"
|
|
msgstr "p, r"
|
|
|
|
#: ../Doc/library/itertools.rst:71
|
|
msgid "r-length tuples, in sorted order, no repeated elements"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:72
|
|
msgid ":func:`combinations_with_replacement`"
|
|
msgstr ":func:`combinations_with_replacement`"
|
|
|
|
#: ../Doc/library/itertools.rst:72
|
|
msgid "r-length tuples, in sorted order, with repeated elements"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:73
|
|
msgid "``product('ABCD', repeat=2)``"
|
|
msgstr "``product('ABCD', repeat=2)``"
|
|
|
|
#: ../Doc/library/itertools.rst:73
|
|
msgid "``AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD``"
|
|
msgstr "``AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD``"
|
|
|
|
#: ../Doc/library/itertools.rst:74
|
|
msgid "``permutations('ABCD', 2)``"
|
|
msgstr "``permutations('ABCD', 2)``"
|
|
|
|
#: ../Doc/library/itertools.rst:74
|
|
msgid "``AB AC AD BA BC BD CA CB CD DA DB DC``"
|
|
msgstr "``AB AC AD BA BC BD CA CB CD DA DB DC``"
|
|
|
|
#: ../Doc/library/itertools.rst:75
|
|
msgid "``combinations('ABCD', 2)``"
|
|
msgstr "``combinations('ABCD', 2)``"
|
|
|
|
#: ../Doc/library/itertools.rst:75
|
|
msgid "``AB AC AD BC BD CD``"
|
|
msgstr "``AB AC AD BC BD CD``"
|
|
|
|
#: ../Doc/library/itertools.rst:76
|
|
msgid "``combinations_with_replacement('ABCD', 2)``"
|
|
msgstr "``combinations_with_replacement('ABCD', 2)``"
|
|
|
|
#: ../Doc/library/itertools.rst:76
|
|
msgid "``AA AB AC AD BB BC BD CC CD DD``"
|
|
msgstr "``AA AB AC AD BB BC BD CC CD DD``"
|
|
|
|
#: ../Doc/library/itertools.rst:83
|
|
msgid "Itertool functions"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:85
|
|
msgid ""
|
|
"The following module functions all construct and return iterators. Some "
|
|
"provide streams of infinite length, so they should only be accessed by "
|
|
"functions or loops that truncate the stream."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:91
|
|
msgid ""
|
|
"Make an iterator that returns accumulated sums, or accumulated results of "
|
|
"other binary functions (specified via the optional *func* argument). If "
|
|
"*func* is supplied, it should be a function of two arguments. Elements of "
|
|
"the input *iterable* may be any type that can be accepted as arguments to "
|
|
"*func*. (For example, with the default operation of addition, elements may "
|
|
"be any addable type including :class:`~decimal.Decimal` or :class:"
|
|
"`~fractions.Fraction`.) If the input iterable is empty, the output iterable "
|
|
"will also be empty."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:101 ../Doc/library/itertools.rst:193
|
|
#: ../Doc/library/itertools.rst:242 ../Doc/library/itertools.rst:468
|
|
#: ../Doc/library/itertools.rst:547 ../Doc/library/itertools.rst:600
|
|
msgid "Roughly equivalent to::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:117
|
|
msgid ""
|
|
"There are a number of uses for the *func* argument. It can be set to :func:"
|
|
"`min` for a running minimum, :func:`max` for a running maximum, or :func:"
|
|
"`operator.mul` for a running product. Amortization tables can be built by "
|
|
"accumulating interest and applying payments. First-order `recurrence "
|
|
"relations <https://en.wikipedia.org/wiki/Recurrence_relation>`_ can be "
|
|
"modeled by supplying the initial value in the iterable and using only the "
|
|
"accumulated total in *func* argument::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:147
|
|
msgid ""
|
|
"See :func:`functools.reduce` for a similar function that returns only the "
|
|
"final accumulated value."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:152
|
|
msgid "Added the optional *func* parameter."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:157
|
|
msgid ""
|
|
"Make an iterator that returns elements from the first iterable until it is "
|
|
"exhausted, then proceeds to the next iterable, until all of the iterables "
|
|
"are exhausted. Used for treating consecutive sequences as a single "
|
|
"sequence. Roughly equivalent to::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:171
|
|
msgid ""
|
|
"Alternate constructor for :func:`chain`. Gets chained inputs from a single "
|
|
"iterable argument that is evaluated lazily. Roughly equivalent to::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:183
|
|
msgid "Return *r* length subsequences of elements from the input *iterable*."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:185 ../Doc/library/itertools.rst:234
|
|
msgid ""
|
|
"Combinations are emitted in lexicographic sort order. So, if the input "
|
|
"*iterable* is sorted, the combination tuples will be produced in sorted "
|
|
"order."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:189
|
|
msgid ""
|
|
"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 values in each "
|
|
"combination."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:215
|
|
msgid ""
|
|
"The code for :func:`combinations` can be also expressed as a subsequence of :"
|
|
"func:`permutations` after filtering entries where the elements are not in "
|
|
"sorted order (according to their position in the input pool)::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:226
|
|
msgid ""
|
|
"The number of items returned is ``n! / r! / (n-r)!`` when ``0 <= r <= n`` or "
|
|
"zero when ``r > n``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:231
|
|
msgid ""
|
|
"Return *r* length subsequences of elements from the input *iterable* "
|
|
"allowing individual elements to be repeated more than once."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:238
|
|
msgid ""
|
|
"Elements are treated as unique based on their position, not on their value. "
|
|
"So if the input elements are unique, the generated combinations will also be "
|
|
"unique."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:261
|
|
msgid ""
|
|
"The code for :func:`combinations_with_replacement` can be also expressed as "
|
|
"a subsequence of :func:`product` after filtering entries where the elements "
|
|
"are not in sorted order (according to their position in the input pool)::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:272
|
|
msgid ""
|
|
"The number of items returned is ``(n+r-1)! / r! / (n-1)!`` when ``n > 0``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:279
|
|
msgid ""
|
|
"Make an iterator that filters elements from *data* returning only those that "
|
|
"have a corresponding element in *selectors* that evaluates to ``True``. "
|
|
"Stops when either the *data* or *selectors* iterables has been exhausted. "
|
|
"Roughly equivalent to::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:293
|
|
msgid ""
|
|
"Make an iterator that returns evenly spaced values starting with number "
|
|
"*start*. Often used as an argument to :func:`map` to generate consecutive "
|
|
"data points. Also, used with :func:`zip` to add sequence numbers. Roughly "
|
|
"equivalent to::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:305
|
|
msgid ""
|
|
"When counting with floating point numbers, better accuracy can sometimes be "
|
|
"achieved by substituting multiplicative code such as: ``(start + step * i "
|
|
"for i in count())``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:309
|
|
msgid "Added *step* argument and allowed non-integer arguments."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:314
|
|
msgid ""
|
|
"Make an iterator returning elements from the iterable and saving a copy of "
|
|
"each. When the iterable is exhausted, return elements from the saved copy. "
|
|
"Repeats indefinitely. Roughly equivalent to::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:328
|
|
msgid ""
|
|
"Note, this member of the toolkit may require significant auxiliary storage "
|
|
"(depending on the length of the iterable)."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:334
|
|
msgid ""
|
|
"Make an iterator that drops elements from the iterable as long as the "
|
|
"predicate is true; afterwards, returns every element. Note, the iterator "
|
|
"does not produce *any* output until the predicate first becomes false, so it "
|
|
"may have a lengthy start-up time. Roughly equivalent to::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:351
|
|
msgid ""
|
|
"Make an iterator that filters elements from iterable returning only those "
|
|
"for which the predicate is ``False``. If *predicate* is ``None``, return the "
|
|
"items that are false. Roughly equivalent to::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:366
|
|
msgid ""
|
|
"Make an iterator that returns consecutive keys and groups from the "
|
|
"*iterable*. The *key* is a function computing a key value for each element. "
|
|
"If not specified or is ``None``, *key* defaults to an identity function and "
|
|
"returns the element unchanged. Generally, the iterable needs to already be "
|
|
"sorted on the same key function."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:372
|
|
msgid ""
|
|
"The operation of :func:`groupby` is similar to the ``uniq`` filter in Unix. "
|
|
"It generates a break or new group every time the value of the key function "
|
|
"changes (which is why it is usually necessary to have sorted the data using "
|
|
"the same key function). That behavior differs from SQL's GROUP BY which "
|
|
"aggregates common elements regardless of their input order."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:378
|
|
msgid ""
|
|
"The returned group is itself an iterator that shares the underlying iterable "
|
|
"with :func:`groupby`. Because the source is shared, when the :func:"
|
|
"`groupby` object is advanced, the previous group is no longer visible. So, "
|
|
"if that data is needed later, it should be stored as a list::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:390
|
|
msgid ":func:`groupby` is roughly equivalent to::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:422
|
|
msgid ""
|
|
"Make an iterator that returns selected elements from the iterable. If "
|
|
"*start* is non-zero, then elements from the iterable are skipped until start "
|
|
"is reached. Afterward, elements are returned consecutively unless *step* is "
|
|
"set higher than one which results in items being skipped. If *stop* is "
|
|
"``None``, then iteration continues until the iterator is exhausted, if at "
|
|
"all; otherwise, it stops at the specified position. Unlike regular "
|
|
"slicing, :func:`islice` does not support negative values for *start*, "
|
|
"*stop*, or *step*. Can be used to extract related fields from data where "
|
|
"the internal structure has been flattened (for example, a multi-line report "
|
|
"may list a name field on every third line). Roughly equivalent to::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:448
|
|
msgid ""
|
|
"If *start* is ``None``, then iteration starts at zero. If *step* is "
|
|
"``None``, then the step defaults to one."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:454
|
|
msgid ""
|
|
"Return successive *r* length permutations of elements in the *iterable*."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:456
|
|
msgid ""
|
|
"If *r* is not specified or is ``None``, then *r* defaults to the length of "
|
|
"the *iterable* and all possible full-length permutations are generated."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:460
|
|
msgid ""
|
|
"Permutations are emitted in lexicographic sort order. So, if the input "
|
|
"*iterable* is sorted, the permutation tuples will be produced in sorted "
|
|
"order."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:464
|
|
msgid ""
|
|
"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 values in each "
|
|
"permutation."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:495
|
|
msgid ""
|
|
"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)::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:507
|
|
msgid ""
|
|
"The number of items returned is ``n! / (n-r)!`` when ``0 <= r <= n`` or zero "
|
|
"when ``r > n``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:512
|
|
msgid "Cartesian product of input iterables."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:514
|
|
msgid ""
|
|
"Roughly 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)``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:517
|
|
msgid ""
|
|
"The nested loops cycle like an odometer with the rightmost element advancing "
|
|
"on every iteration. This pattern creates a lexicographic ordering so that "
|
|
"if the input's iterables are sorted, the product tuples are emitted in "
|
|
"sorted order."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:522
|
|
msgid ""
|
|
"To compute the product of an iterable with itself, specify the number of "
|
|
"repetitions with the optional *repeat* keyword argument. For example, "
|
|
"``product(A, repeat=4)`` means the same as ``product(A, A, A, A)``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:526
|
|
msgid ""
|
|
"This function is roughly equivalent to the following code, except that the "
|
|
"actual implementation does not build up intermediate results in memory::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:542
|
|
msgid ""
|
|
"Make an iterator that returns *object* over and over again. Runs "
|
|
"indefinitely unless the *times* argument is specified. Used as argument to :"
|
|
"func:`map` for invariant parameters to the called function. Also used with :"
|
|
"func:`zip` to create an invariant part of a tuple record."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:558
|
|
msgid ""
|
|
"A common use for *repeat* is to supply a stream of constant values to *map* "
|
|
"or *zip*::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:566
|
|
msgid ""
|
|
"Make an iterator that computes the function using arguments obtained from "
|
|
"the iterable. Used instead of :func:`map` when argument parameters are "
|
|
"already grouped in tuples from a single iterable (the data has been \"pre-"
|
|
"zipped\"). The difference between :func:`map` and :func:`starmap` parallels "
|
|
"the distinction between ``function(a,b)`` and ``function(*c)``. Roughly "
|
|
"equivalent to::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:580
|
|
msgid ""
|
|
"Make an iterator that returns elements from the iterable as long as the "
|
|
"predicate is true. Roughly equivalent to::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:594
|
|
msgid "Return *n* independent iterators from a single iterable."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:596
|
|
msgid ""
|
|
"The following Python code helps explain what *tee* does (although the actual "
|
|
"implementation is more complex and uses only a single underlying :abbr:`FIFO "
|
|
"(first-in, first-out)` queue)."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:617
|
|
msgid ""
|
|
"Once :func:`tee` has made a split, the original *iterable* should not be "
|
|
"used anywhere else; otherwise, the *iterable* could get advanced without the "
|
|
"tee objects being informed."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:621
|
|
msgid ""
|
|
"This itertool may require significant auxiliary storage (depending on how "
|
|
"much temporary data needs to be stored). In general, if one iterator uses "
|
|
"most or all of the data before another iterator starts, it is faster to use :"
|
|
"func:`list` instead of :func:`tee`."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:629
|
|
msgid ""
|
|
"Make an iterator that aggregates elements from each of the iterables. If the "
|
|
"iterables are of uneven length, missing values are filled-in with "
|
|
"*fillvalue*. Iteration continues until the longest iterable is exhausted. "
|
|
"Roughly equivalent to::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:654
|
|
msgid ""
|
|
"If one of the iterables is potentially infinite, then the :func:"
|
|
"`zip_longest` function should be wrapped with something that limits the "
|
|
"number of calls (for example :func:`islice` or :func:`takewhile`). If not "
|
|
"specified, *fillvalue* defaults to ``None``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:663
|
|
msgid "Itertools Recipes"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:665
|
|
msgid ""
|
|
"This section shows recipes for creating an extended toolset using the "
|
|
"existing itertools as building blocks."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:668
|
|
msgid ""
|
|
"The extended tools offer the same high performance as the underlying "
|
|
"toolset. The superior memory performance is kept by processing elements one "
|
|
"at a time rather than bringing the whole iterable into memory all at once. "
|
|
"Code volume is kept small by linking the tools together in a functional "
|
|
"style which helps eliminate temporary variables. High speed is retained by "
|
|
"preferring \"vectorized\" building blocks over the use of for-loops and :"
|
|
"term:`generator`\\s which incur interpreter overhead."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/itertools.rst:861
|
|
msgid ""
|
|
"Note, many of the above recipes can be optimized by replacing global lookups "
|
|
"with local variables defined as default values. For example, the "
|
|
"*dotproduct* recipe can be written as::"
|
|
msgstr ""
|