In article <050094ea-faf4-4e03-875d-9c2c63090...@y17g2000yqn.googlegroups.com>, Bearophile <bearophileh...@lycos.com> 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 (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "as long as we like the same operating system, things are cool." --piranha -- http://mail.python.org/mailman/listinfo/python-list