> I have a long string (several Mbytes). I want to iterate over it in > manageable chunks
This is a weirdly common question. See http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python for several solutions. It's been proposed to be added to itertools before, but rejected: https://mail.python.org/pipermail/python-ideas/2012-July/015671.html and http://bugs.python.org/issue13095 - Nick Cash -- https://mail.python.org/mailman/listinfo/python-list