libb.roundrobin

roundrobin(*iterables)[source]

Visit input iterables in a cycle until each is exhausted.

>>> list(roundrobin('ABC', 'D', 'EF'))
['A', 'D', 'E', 'B', 'F', 'C']

This function produces the same output as interleave_longest(), but may perform better for some inputs (in particular when the number of iterables is small).