import itertools def chunked(it, size): it = iter(it) while True: p = tuple(itertools.islice(it, size)) if not p: break yield p
for chunk in chunked(big_dict.iteritems(), batch_size): func(chunk)