Commit Graph

175 Commits

Author SHA1 Message Date
Miss Islington (bot) 640454fd32
[3.11] Fix docstring and var name of itertools recipe (GH-112113) (#112311)
Fix docstring and var name of itertools recipe (GH-112113)

`prepend()` works with arbitrary iterables, not only iterators. In fact,
the example given uses a `list`, which is iterable, but not an iterator.
(cherry picked from commit 6c47eaccfa)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2023-11-22 05:41:51 +00:00
Miss Islington (bot) 60b2b58f87
[3.11] Minor readability improvement to the factor() recipe (GH-102971) (GH-102972) 2023-03-23 14:56:35 -05:00
Raymond Hettinger e6e3b1b27d
[3.11] Backport itertool recipe updates (GH-102881) 2023-03-21 13:44:32 -05:00
Miss Islington (bot) 3effccee48
[3.11] gh-102088 Optimize iter_index itertools recipe (GH-102360) (GH-102363) 2023-03-01 21:52:37 -06:00
Miss Islington (bot) 3b4f8fc83d
gh-102105 Fix wording in filterfalse/quantify/filter (GH-102189)
(cherry picked from commit 81bf10e4f2)

Co-authored-by: Stefan Pochmann <609905+pochmann@users.noreply.github.com>
2023-02-24 08:21:40 -08:00
Raymond Hettinger ba88628808
[3.11] Add recipes to showcase tee(), zip*, batched, starmap, and product. (GH-101028) 2023-01-13 22:32:32 -06:00
Raymond Hettinger 4b4e6da7b5
[3.11] Future-proof recipe by renaming dotproduct() to sumprod() (GH-100828) 2023-01-07 15:16:38 -06:00
Miss Islington (bot) 18006309ea
[3.11] Improve comments in itertools uniquification recipes (GH-100631) (GH-100632) 2022-12-30 22:23:39 -06:00
Miss Islington (bot) 9120450b25
Restore early-out to factor(). Strengthen tests. (GH-100591)
(cherry picked from commit c4c5790120)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2022-12-28 12:37:58 -08:00
Miss Islington (bot) 95fa61cbce
Improve factor() recipe and fix its tests (GH-100576)
(cherry picked from commit 2d52406835)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2022-12-28 03:22:11 -08:00
Miss Islington (bot) ba87dae453
Misc Itertools recipe tweaks (GH-100493)
(cherry picked from commit 0769f95751)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2022-12-24 00:31:36 -08:00
Miss Islington (bot) 9477594374
Add "strict" to dotproduct(). Add docstring. Factor-out common code. (GH-100480)
(cherry picked from commit f89de679ff)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2022-12-23 16:00:21 -08:00
Raymond Hettinger 09186676cf
[3.11] GH-98363: Update batched() recipe in docs to match 3.12 (#100323) 2022-12-17 19:10:03 -06:00
Miss Islington (bot) 9d2dcbbccd
[3.11] Remove uninformative itertools recipe (GH-100253) (GH-100275) 2022-12-15 12:47:58 -06:00
Miss Islington (bot) 43cbb3df9a
Doc: Fix sphinx-lint issues (GH-98911)
They were introduced right between GH-98441 and GH-98408.
(cherry picked from commit c1c3be0f9d)

Co-authored-by: Julien Palard <julien@palard.fr>
2022-10-31 10:29:30 -07:00
Raymond Hettinger 07cc997e00
[3.11] Sync the batched() recipe with the 3.12 implementation (GH-98446) 2022-10-19 09:21:14 -05:00
Miss Islington (bot) f1a240abab
General improvements to the itertools docs (GH-98408)
(cherry picked from commit f4ead4874b)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2022-10-18 12:17:40 -07:00
Miss Islington (bot) 9cb30bb339
Move random selection recipes from itertools.rst to random.rst (GH-98369)
(cherry picked from commit 70732d8a4c)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2022-10-17 15:38:22 -07:00
Miss Islington (bot) a2ae35dfa4
[3.11] Improve speed. Reduce auxiliary memory to 16.6% of the main array. (GH-98294) (GH-98303) 2022-10-15 16:24:05 -05:00
Miss Islington (bot) 42511fc72d
Faster sieve() recipe (GH-98287)
(cherry picked from commit f4370318d6)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2022-10-15 10:52:45 -07:00
Miss Islington (bot) d7547fc6fb
Misc updates to the itertools recipes and tests (GH-98018)
(cherry picked from commit e500cc0451)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2022-10-07 01:46:31 -07:00
Miss Islington (bot) 1448e2a42b
Simplify sieve() recipe. Add edge case tests. (GH-96892)
(cherry picked from commit 78359b1d45)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2022-09-17 20:11:29 -07:00
Miss Islington (bot) a0685136dc
Itertools sieve() recipe (GH-96813) (GH-96814) 2022-09-13 21:23:30 -05:00
Miss Islington (bot) 21c46f359b
Add polynomial_from_roots() to the itertools recipes (GH-96102) (#96155) 2022-08-21 09:47:45 -05:00
Miss Islington (bot) b52e44d933
Take advantage of math.comb() in the nth_combination() recipe (GH-93027) (#93032) 2022-05-20 18:34:30 -05:00
Ville Skyttä dc14e33eff
bpo-22295: use python -m pip rather than plain pip in more examples (GH-24003) 2022-04-09 14:37:01 -04:00
Raymond Hettinger 06a491179f
Add recipe for subslices (GH-31028) 2022-02-01 22:18:52 -06:00
Raymond Hettinger ee60550e9b
Move doctests to the main docs. Eliminate duplication. Improve coverage. (GH-30869) 2022-01-25 06:56:53 -06:00
Raymond Hettinger 270a09184d
Improve grouper() recipe to demonstrate all forms of zip() (GH-30837) 2022-01-23 14:31:10 -06:00
Raymond Hettinger fcbf9b176b
Docs: Clarify the before_and_after() example (GH-28458) 2021-09-19 19:52:27 -05:00
Raymond Hettinger 80d9ff1648
Fix typo and add a module prefix (GH-28401) 2021-09-16 23:49:41 -05:00
Raymond Hettinger 750368cbcd
Add more itertool recipes (GH-28165) 2021-09-07 12:29:00 -05:00
Raymond Hettinger 91be41ad93
bpo-44571: Add itertool recipe for a variant of takewhile() (GH-28167) 2021-09-05 00:09:26 -05:00
Raymond Hettinger f421bfce80
Minor improvements to the convolve() recipe (GH-24012)
* Minor improvement to speed and space efficiency for the convolve() recipe
* Don't require convolve's kernel to be a sequence.
2020-12-30 12:51:19 -08:00
Raymond Hettinger 77fde8dc16
Add convolve() to the itertools recipes (GH-23928) 2020-12-25 16:43:20 -08:00
Zackery Spytz 074ad5123f
bpo-42670: Fix a missing word in the itertools.product() docs (GH-23823) 2020-12-17 12:24:43 -08:00
Raymond Hettinger cc061d0e6f
bpo-38200: Add itertools.pairwise() (GH-23549) 2020-11-30 20:42:54 -08:00
Raymond Hettinger fc40b3020c
bpo-42450: Minor updates to the itertools recipes (GH-23555) 2020-11-29 10:47:22 -08:00
Ruaridh Williamson 5e0ed8abc9
Note the output ordering of combinatoric functions (GH-19732) 2020-05-28 12:56:43 -07:00
Ramil Nugmanov cfc6ce4d40
bpo-40806: Clarify that itertools.product immediately consumes its inpt (GH-20492) 2020-05-28 09:46:22 -07:00
Борис Верховский 99b7701978 Convert argument to snake_case (GH-16990) 2019-11-02 12:09:14 -07:00
Serhiy Storchaka 526a01467b
bpo-34410: Fix a crash in the tee iterator when re-enter it. (GH-15625)
RuntimeError is now raised in this case.
2019-09-09 11:47:14 +03:00
Serhiy Storchaka 918b468b7d
Revert "Raise a RuntimeError when tee iterator is consumed from different threads (GH-15567)" (GH-15736)
This reverts commit fa220ec763.
2019-09-09 11:18:16 +03:00
HongWeipeng fa220ec763 Raise a RuntimeError when tee iterator is consumed from different threads (GH-15567) 2019-08-28 20:39:25 -07:00
Raymond Hettinger adf02b36b3
Update itertools docs (GH-15114)
* Remove suggestion that is less relevant now that global lookups are much faster
* Add link for installing the recipes
2019-08-04 13:35:58 -07:00
Jakub Molinski b4c7f39bbf Add module specification: itemgetter -> operator.itemgetter (GH-12823) 2019-04-23 01:30:30 -07:00
Benedikt Werner 14e3c447c1 Fix table formatting in itertools doc (GH-12228) 2019-03-21 08:28:49 -07:00
Lisa Roach 9718b59ee5
bpo-34659: Adds initial kwarg to itertools.accumulate() (GH-9345) 2018-09-23 17:34:59 -07:00
Raymond Hettinger 9265dd72e5
Add a prepend() recipe to teach a chain() idiom (GH-6415) 2018-04-08 08:44:20 -07:00
Cheryl Sabella da1734c58d bpo-27212: Modify islice recipe to consume initial values preceding start (GH-6195) 2018-03-26 18:29:33 -07:00