Python Sorts With Comparator
def mycmp(a, b):
if a < b:
return -1
elif a > b:
return 1
return 0
sorted(lst, key=functools.cmp_to_key(mycmp))
# functools.cmp_to_key converts the mycmp to a "key function",
# which returns an object that can be sorted accoding to mycmp
Johan