itertools icon indicating copy to clipboard operation
itertools copied to clipboard

Add `cycle_n` iterator

Open ghost opened this issue 8 years ago • 2 comments

Same as cycle but with finite number of repeats.

ghost avatar Jun 22 '17 13:06 ghost

Can we say that we already cover this with itertools::repeat_n(iter, n).flatten()?

bluss avatar Jul 30 '17 22:07 bluss

Microbenchmarks say dedicated function will get optimized better.

And, personally, I would prefer being able to do this with only dot-chaining

NooneAtAll3 avatar Jun 18 '23 00:06 NooneAtAll3