8000 Update itertools docs (GH-15114) (GH-15118) · python/cpython@fc6e3bc · GitHub
[go: up one dir, main page]

Skip to content

Commit fc6e3bc

Browse files
Update itertools docs (GH-15114) (GH-15118)
* Remove suggestion that is less relevant now that global lookups are much faster * Add link for installing the recipes (cherry picked from commit adf02b3) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
1 parent 0c16f6b commit fc6e3bc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Doc/library/itertools.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,12 @@ Itertools Recipes
691691
This section shows recipes for creating an extended toolset using the existing
692692
itertools as building blocks.
693693

694+
Substantially all of these recipes and many, many others can be installed from
695+
the `more-itertools project <https://pypi.org/project/more-itertools/>`_ found
696+
on the Python Package Index::
697+
698+
pip install more-itertools
699+
694700
The extended tools offer the same high performance as the underlying toolset.
695701
The superior memory performance is kept by processing elements one at a time
696702
rather than bringing the whole iterable into memory all at once. Code volume is
@@ -913,9 +919,3 @@ which incur interpreter overhead.
913919
result.append(pool[-1-n])
914920
return tuple(result)
915921

916-
Note, many of the above recipes can be optimized by replacing global lookups
917-
with local variables defined as default values. For example, the
918-
*dotproduct* recipe can be written as::
919-
920-
def dotproduct(vec1, vec2, sum=sum, map=map, mul=operator.mul):
921-
return sum(map(mul, vec1, vec2))

0 commit comments

Comments
 (0)
0