[Python-ideas] Add 'interleave' function to itertools?
Vito De Tullio
vito.detullio at gmail.com
Thu Aug 8 07:48:20 CEST 2013
Serhiy Storchaka wrote:
>> def interleave(*iterables):
>> for zipped_iterables in zip(*iterables):
>> yield from zipped_iterables
>>
>> sufficient?
>
> chain.from_iterable(zip(*iterables))
I always forget it...
My first approach was to call chain(), the second sum(..., []), I fall back
to a for + yield approach... (at least the last one it's correct :D)
--
By ZeD
More information about the Python-ideas
mailing list