[Python-Dev] Re: "groupby" iterator

David Eppstein eppstein at ics.uci.edu
Sun Nov 30 23:42:18 EST 2003

On 11/30/03 11:35 PM -0500 Raymond Hettinger <python at rcn.com> wrote:
> Okay, I've decided on this one.
> Though David's idea is attractive in its generality, the use cases favor
> the previous implementation.  IOW, there is a reasonable use case for
> skipping or partially consuming the subiterators (e.g. "sort s | uniq"
> and  "sort s | uniq -d").  For the delinguent subiterators, the user can
> just convert them to a list if they are going to be needed later:

My implementation will skip or partially consume the subiterators, with 
only a very temporary additional use of memory, if you don't keep a 
reference to them.
But I can see your arguments about visible vs silent failure modes and code 
David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science

More information about the Python-Dev mailing list