Have you heard of boltons?
Boltons is a set of pure-Python utilities in the same spirit as — and yet conspicuously missing from — the the standard library
It has what you want, built-in, called chunked
from boltons import iterutils
iterutils.chunked([1,2,3,4,5,6,7,8], 3)
Output:
[[1, 2, 3], [4, 5, 6], [7, 8]]
And whats more attractive in boltons is that it has chunked as an iterator, called chunked_iter, so you don't need to store the whole thing in memory. Neat, right?