Skip to content

Commit

Permalink
Collect repeatfunc() tests in one place.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhettinger committed Oct 8, 2024
1 parent 922a7bf commit 46d1ff0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Doc/library/itertools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1261,12 +1261,6 @@ The following recipes have a more mathematical flavor:
[1, 2, 3, 4, 5, 6]


>>> list(repeatfunc(pow, 5, 2, 3))
[8, 8, 8, 8, 8]
>>> take(5, map(int, repeatfunc(random.random)))
[0, 0, 0, 0, 0]


>>> list(ncycles('abc', 3))
['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c']
>>> # Verify greedy consumption of input iterator
Expand Down Expand Up @@ -1551,6 +1545,10 @@ The following recipes have a more mathematical flavor:
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']


>>> list(repeatfunc(pow, 5, 2, 3))
[8, 8, 8, 8, 8]
>>> take(5, map(int, repeatfunc(random.random)))
[0, 0, 0, 0, 0]
>>> random.seed(85753098575309)
>>> list(repeatfunc(random.random, 3))
[0.16370491282496968, 0.45889608687313455, 0.3747076837820118]
Expand Down

0 comments on commit 46d1ff0

Please sign in to comment.