Duncan Booth wrote: > Nice, thank you.
Welcome. > But why 'count(chunksize)' rather than just 'count()'? To number the first chunk 1, etc. using count() starts with 0. Matter of taste. > Does it make a difference anywhere? And I'd recommend using // rather than > / otherwise it breaks if you do 'from __future__ import division': Right. > > def chunked(chunksize,f) : > from itertools import count,groupby > counter=count().next > return groupby(f,lambda _ : counter()//chunksize) > -- http://mail.python.org/mailman/listinfo/python-list