"Satchidanand Haridas" <[EMAIL PROTECTED]> wrote: > >So, I want to sort myList by the return of myFunction( value3 ) > > > >I tried doing the following... with no luck so far > >myList.sort(lambda x, y: cmp(myFunction(x[2]), myFunction(y[2])) > > > > > > > I think the above statement should be as follows: > > myList.sort(lambda x, y: cmp(myFunction(x[2]) - myFunction(y[2])) > > > > hope that helps.
It would help more if you tested it before you posted. cmp takes two arguments (let alone that subtraction may not be defined for the list elements), so the original version is correct. George -- http://mail.python.org/mailman/listinfo/python-list