Question on lists

Matteo Dell'Amico della at
Wed Jul 28 11:08:14 CEST 2004

Andrew Bennetts wrote:

> Nothing builtin that I know of, but it's trivial to write:

Using 2.4, looks like the logic is in itertools.groupby:

 >>> from itertools import groupby
 >>> l = ['a', 'b', 'c', 'c', 'd', 'd', 'd', 'e']
 >>> list(x for x, _ in itertools.groupby(l))
['a', 'b', 'c', 'd', 'e']


More information about the Python-list mailing list