summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/itertools.rst5
1 files changed, 5 insertions, 0 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 68a6c83..d1d1188 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -496,6 +496,11 @@ loops that truncate the stream.
for i in range(times):
yield object
+ A common use for *repeat* is to supply a stream of constant values to *map*
+ or *zip*::
+
+ >>> list(map(pow, range(10), repeat(2)))
+ [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
.. function:: starmap(function, iterable)