(sorted is a built-in function in 2.4) def myFunction( data ): """ Take one of your set of 3, grab [2] (the 3rd) and do calcs, return value """ "do some math calculations to data[2]" return "result of calculations"
sorted_list = sorted(myList, key=myFunction) List is sorted in the order of the 'key' values, key being a value returned from myFunction which operates on [2]. -- http://mail.python.org/mailman/listinfo/python-list