Aahz aahz at
Wed Jul 8 21:33:57 CEST 2009

In article <050094ea-faf4-4e03-875d-9c2c63090a89 at>,
Bearophile  <bearophileHUGS at> wrote:
>Vilya Harvey:
>> from itertools import groupby
>> for x, g in groupby([fields[1] for fields in data]):
>> =A0 =A0 print x, len(tuple(g))
>Avoid that len(tuple(g)), use something like the following, it's lazy
>and saves some memory.

The question is whether it saves time, have you tested it?
Aahz (aahz at           <*>

"as long as we like the same operating system, things are cool." --piranha

More information about the Python-list mailing list