From: Raymond Hettinger Date: Wed, 1 Feb 2012 17:07:40 +0000 (-0800) Subject: Add usage note X-Git-Tag: v3.2.3rc1~103 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fc3ba6b8fc0d9212cbae676a5c84847245767464;p=thirdparty%2FPython%2Fcpython.git Add usage note --- diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 68a6c8307556..d1d1188106e4 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)