Add batching function to itertools module - Ideas - Discussions on Python.org
Batching of lists, arrays, iterables, etc. is a pretty common operation, which is why I was surprised that this functionality has not already been implemented as part of the itertools module when I recently went looking …