[docs] [issue20727] Improved roundrobin itertools recipe

Raymond Hettinger report at bugs.python.org
Thu Aug 22 06:05:04 EDT 2019

Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

Thanks for the suggestion.  I appreciate it even though I've decided to keep the current recipe.

While he proposed recipe is really good at eliminating exhausted input sources, it is slower at its core task of yielding outputs (which is typically the important part).

The O(n) step in the current code runs at C speed and is really fast.  On my six year old machine, running :cycle(islice(nexts, num_active))" for 1,000 nexts takes only 186ns.

One other thought:  The existing recipe is also useful for showing off ways to use the itertools (which was really the principal purpose of having a recipes section).

resolution: remind -> rejected
stage: patch review -> resolved
status: open -> closed

Python tracker <report at bugs.python.org>

More information about the docs mailing list