mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
Add usage note
This commit is contained in:
parent
4d82ade424
commit
fc3ba6b8fc
1 changed files with 5 additions and 0 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue