itertools.groupby
Steve Howell
showell30 at yahoo.com
Mon May 28 18:03:42 EDT 2007
--- Raymond Hettinger <python at rcn.com> wrote:
> > > That's not for everyone, so it isn't a loss if
> > > someone sticks
> > > with writing plain, clear everyday Python
> instead of
> > > an itertool.
> >
> > I know most of the module is fairly advanced, and
> that
> > average users can mostly avoid it, but this is a
> very
> > common-antipattern that groupby() solves:
>
> I think the OP would have been better-off with plain
> vanilla Python such as:
>
> See
>
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/259173
>
That recipe implements SQL-like Group By, but it's the
uniq-like reimplementation of groupby() that I think
is error prone.
The OP was writing code that wanted the uniq-like
semantics.
____________________________________________________________________________________Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow
More information about the Python-list
mailing list