summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2019-08-04 20:35:58 (GMT)
committerGitHub <noreply@github.com>2019-08-04 20:35:58 (GMT)
commitadf02b36b3f3745ad4ee380d88f2f6011f54fc22 (patch)
tree5f2648371d00d0972f8a3014b94ea5a142fcd453 /Doc/library
parentb1c8ec010fb4eb2654ca994e95144c8f2fea07fb (diff)
downloadcpython-adf02b36b3f3745ad4ee380d88f2f6011f54fc22.zip
cpython-adf02b36b3f3745ad4ee380d88f2f6011f54fc22.tar.gz
cpython-adf02b36b3f3745ad4ee380d88f2f6011f54fc22.tar.bz2
Update itertools docs (GH-15114)
* Remove suggestion that is less relevant now that global lookups are much faster * Add link for installing the recipes
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/itertools.rst12
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index b3a0a5f..a3f403a 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -691,6 +691,12 @@ Itertools Recipes
This section shows recipes for creating an extended toolset using the existing
itertools as building blocks.
+Substantially all of these recipes and many, many others can be installed from
+the `more-itertools project <https://pypi.org/project/more-itertools/>`_ found
+on the Python Package Index::
+
+ pip install more-itertools
+
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
@@ -913,9 +919,3 @@ which incur interpreter overhead.
result.append(pool[-1-n])
return tuple(result)
-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::
-
- def dotproduct(vec1, vec2, sum=sum, map=map, mul=operator.mul):
- return sum(map(mul, vec1, vec2))