Using a comparator function to sort
In Python 3 there is no cmp argument for the sorted function (nor for list.sort). According to the docs, the signature is now sorted(iterable, *, key=None, reverse=False), so you have to use a key function to do a custom sort. The docs suggest: Use functools.cmp_to_key() to convert an old-style cmp function to a key function. … Read more