[Python-ideas] Add 'interleave' function to itertools?

Andrew Barnert abarnert at yahoo.com
Fri Aug 9 18:51:17 CEST 2013


On Aug 9, 2013, at 9:32, Oscar Benjamin <oscar.j.benjamin at gmail.com> wrote:

> Similarly grouper() probably doesn't do what anyone really wants
> (since it discards the end of the iterable).

What do you mean by that? Every element in the original iterable ends up in one of the groups; nothing is discarded.

I use this all the time. (Well, I often end up writing a "pairs" iterator by hand, and don't reach for grouper unless I already need it for different sized groups... But that's probably an argument _for_ putting it in the module, not against.)


More information about the Python-ideas mailing list