I've added a new function to itertools called 'concat'.  This function is much like chain, but takes all of the iterables as a single argument.
I've needed this once or twice, though my implementation was called 'starchain', in line with 'starmap'.  I'm not a big fan of either name, though -- 'chainstar' and 'mapstar' are only marginally better (though it makes me want to come up with 'saw' and 'chainsaw' functions).  Nor can I comment on the general applicability of such a function, other than to say that it was useful in some of my applications that utilize iterators of iterators of indeterminate length.

-Kevin">

(original) (raw)

On 9/22/07, Bruce Frederiksen <dangyogi@gmail.com> wrote:

I've added a new function to itertools called 'concat'.  This function is much like chain, but takes all of the iterables as a single argument.

I've needed this once or twice, though my implementation was called 'starchain', in line with 'starmap'.  I'm not a big fan of either name, though -- 'chainstar' and 'mapstar' are only marginally better (though it makes me want to come up with 'saw' and 'chainsaw' functions).  Nor can I comment on the general applicability of such a function, other than to say that it was useful in some of my applications that utilize iterators of iterators of indeterminate length.

-Kevin