Another itertool function?

Steven Taschuk staschuk at
Sat Apr 26 21:10:49 CEST 2003

Quoth Magnus Lie Hetland:
> def weave(*iterables):
>     iterables = map(iter, iterables)
>     while iterables:
>         for it in iterables[:]:
>             try:
>                 yield
>             except StopIteration:
>                 iterables.remove(it)
> Another possible name (which is a bit more unwieldy) would be
> 'roundrobin'. Another one still is iweave (to keep the naming
> convention, even though here there is no clash).

I wrote an equivalent function a while back, too; I called it

(I can't remember what I needed it for, oddly.)

Steven Taschuk                                                   w_w
staschuk at                                      ,-= U
                                                               1 1

More information about the Python-list mailing list