mirror of https://github.com/python/cpython
Add a usage note
This commit is contained in:
parent
1d4ae48f48
commit
bdb7fe4c84
|
@ -590,6 +590,11 @@ loops that truncate the stream.
|
||||||
for i in xrange(times):
|
for i in xrange(times):
|
||||||
yield object
|
yield object
|
||||||
|
|
||||||
|
A common use for *repeat* is to supply a stream of constant values to *imap*
|
||||||
|
or *zip*::
|
||||||
|
|
||||||
|
>>> list(imap(pow, range(10), repeat(2)))
|
||||||
|
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
|
||||||
|
|
||||||
.. function:: starmap(function, iterable)
|
.. function:: starmap(function, iterable)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue