itertools.groupby

Paul Rubin http
Mon May 28 18:58:22 EDT 2007


Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:
> >    See http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/259173
> But that recipe generates the groups in a random order depending on
> the dict hashing, 

Correction, it generates the right order in this case, although it
builds up an in-memory copy of the entire input, which could be
problematic if the input is large (e.g. the input sequence is coming
from a file or socket stream).



More information about the Python-list mailing list