Possible Duplicate:
How do you split a list into evenly sized chunks in Python?
If you have an iterator iter
with values i0, i1, i2, ...
, what's the most Pythonic way to get an iterator whose values are
[i0, i1, i2], [i3, i4, i5], ...
The above would be the output to a hypothetical groupby(iter, 3)
.