Re: [Tutor] Question about sorting a list within a dictionary within a list

2011-08-01 Thread Peter Otten
Peter Otten wrote: > Untested: > > from operator import attrgetter, itemgetter > from itertools import imap > > firsts = imap(itemgetter(0), conn.get_all_instances()) > reservations = sorted(firsts, key=attrgetter("launch_time")) > > This gives you objects rather than the objects' __dict__s. O

Re: [Tutor] Question about sorting a list within a dictionary within a list

2011-08-01 Thread Peter Otten
ian douglas wrote: > On 08/01/2011 01:03 PM, Peter Otten wrote: >> ian douglas wrote: >> >>> I'm using the Bono library for talking to EC2, and I'm getting a list of >>> >>> I cannot help you with the django or boto part. > > Well, I suppose that using django/bono wasn't really relevant to the >

Re: [Tutor] Question about sorting a list within a dictionary within a list

2011-08-01 Thread ian douglas
On 08/01/2011 01:03 PM, Peter Otten wrote: ian douglas wrote: I'm using the Bono library for talking to EC2, and I'm getting a list of I cannot help you with the django or boto part. Well, I suppose that using django/bono wasn't really relevant to the question. I appreciate the feedback t

Re: [Tutor] Question about sorting a list within a dictionary within a list

2011-08-01 Thread Peter Otten
ian douglas wrote: > I'm using the Bono library for talking to EC2, and I'm getting a list of > EC2 instances back in a list called "reservations". Each element in the > list is a dictionary of information. One of those dictionary elements is > a list called 'instances', and I only ever care about

[Tutor] Question about sorting a list within a dictionary within a list

2011-08-01 Thread ian douglas
I'm using the Bono library for talking to EC2, and I'm getting a list of EC2 instances back in a list called "reservations". Each element in the list is a dictionary of information. One of those dictionary elements is a list called 'instances', and I only ever care about the first entry. That i