Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fc3ba6b

Browse files
committed
Add usage note
1 parent 4d82ade commit fc3ba6b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Doc/library/itertools.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,11 @@ loops that truncate the stream.
496496
for i in range(times):
497497
yield object
498498

499+
A common use for *repeat* is to supply a stream of constant values to *map*
500+
or *zip*::
501+
502+
>>> list(map(pow, range(10), repeat(2)))
503+
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
499504

500505
.. function:: starmap(function, iterable)
501506

0 commit comments

Comments
 (0)