Re: [Tutor] calculating a sort key and operator.attrgetter()

2009-07-01 Thread Vincent Davis
Thanks for the help, Looks like I will define a function. And yes you are right self.does_observe is constant so it will not affect the outcome. Thanks again Vincent Davis On Tue, Jun 30, 2009 at 11:15 PM, Kent Johnson wrote: > On Tue, Jun 30, 2009 at 11:39 PM, Vincent Davis > wrote: > > I ha

Re: [Tutor] calculating a sort key and operator.attrgetter()

2009-07-01 Thread Kent Johnson
On Tue, Jun 30, 2009 at 11:39 PM, Vincent Davis wrote: > I have a class with an attribute which is a list "rank_list" this is a list > of instances f another class that has attributes "quality, is_observed" > if I want to sort the list by the attribute "quality" I can just use, > self.rank_list.sor

[Tutor] calculating a sort key and operator.attrgetter()

2009-06-30 Thread Vincent Davis
I have a class with an attribute which is a list "rank_list" this is a list of instances f another class that has attributes "quality, is_observed" if I want to sort the list by the attribute "quality" I can just use, self.rank_list.sort(key=operator.attrgetter('quality')) But I want to sort like t