summaryrefslogtreecommitdiffstats
path: root/Doc/library/itertools.rst
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2012-02-01 17:07:40 (GMT)
committerRaymond Hettinger <python@rcn.com>2012-02-01 17:07:40 (GMT)
commitfc3ba6b8fc0d9212cbae676a5c84847245767464 (patch)
treeb6e131c6286c0c0f31b5b7c8e28c702b288e4965 /Doc/library/itertools.rst
parent4d82ade42471e0503d82012116d0b128d7120f7f (diff)
downloadcpython-fc3ba6b8fc0d9212cbae676a5c84847245767464.zip
cpython-fc3ba6b8fc0d9212cbae676a5c84847245767464.tar.gz
cpython-fc3ba6b8fc0d9212cbae676a5c84847245767464.tar.bz2
Add usage note
Diffstat (limited to 'Doc/library/itertools.rst')
-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)