Sorting list of objects on arbitrary attribute

Max M maxm at mxm.dk
Thu Jul 18 10:25:40 EDT 2002


Emile van Sebille wrote:
>>the standard library, or somebody has a 2 liner which does the same
> thing.
> 
> aList.sort(lambda x,y: cmp( (x.name, x.age, x.rand) , (y.name, y.age,
> y.rand) ) )


You are too clever for your own good ...

regards Max M




More information about the Python-list mailing list