This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients Dubslow, docs@python, rhettinger, serhiy.storchaka, terry.reedy, tim.peters
Date 2017-11-21.17:04:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1511283858.52.0.213398074469.issue32099@psf.upfronthosting.co.za>
In-reply-to
Content
While we're on the topic, I had some thought of also adding a similar recipe to https://docs.python.org/3/library/collections.html#deque-recipes .  The alternative recipe is slower is common cases but doesn't degrade when there are a huge number of iterables:  

    def roundrobin(*iterables):
        "roundrobin('ABC', 'D', 'EF') --> A D E B F C"
        nexts = deque(iter(it).__next__ for it in iterables)
        while nexts:
            try:
                while True:
                    yield nexts[0]()
                    nexts.rotate(-1)
            except StopIteration:
                nexts.popleft()
History
Date User Action Args
2017-11-21 17:04:18rhettingersetrecipients: + rhettinger, tim.peters, terry.reedy, docs@python, serhiy.storchaka, Dubslow
2017-11-21 17:04:18rhettingersetmessageid: <1511283858.52.0.213398074469.issue32099@psf.upfronthosting.co.za>
2017-11-21 17:04:18rhettingerlinkissue32099 messages
2017-11-21 17:04:18rhettingercreate