Thomas Bach <thb...@students.uni-mainz.de> writes:
>>>> result = [ [('foo', 1), ('foo', 2)], [('bar', 3), ('bar', 2)] ]
> by _only_ _iterating_ over the list (caching all the elements sharing
> the same first element doesn't count)?

itertools.groupby(data, lambda (x,y) : x)

is basically what you want.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to