[Tutor] sorting objects on two attributes
eric at abrahamsen.com
Tue Mar 4 04:44:32 CET 2008
On Mar 4, 2008, at 11:04 AM, Kent Johnson wrote:
> Eric Abrahamsen wrote:
>> Itertools.groupby is totally impenetrable to me
> Maybe this will help:
It did! Thanks very much. I think I understand now what's going on in
the groupby line. And then this line:
t.append((sorted_part[-1].submit_date, key, sorted_part))
is basically a Decorate-Sort-Undecorate operation, sorting on
sorted_part[-1].submit_date because that's guaranteed to be the latest
date in each group?
It's starting to come clear...
More information about the Tutor