Question
In python 3, what is the easy way to sort a list, using "sorted" method, using a custom comparison function (for example, how to sort release_numbers = [1.2, 4.4.4, 1.2.1], using custom "compare" function that compares 1.2 to 1.2.1)?
Answer
sorted(release_numbers, key=functools.cmp_to_key(compare))
^^ note, in python 3, sorted does not have the cmp argument so you have to use the key argument via the functools.cmp_to_key conversion method)
^^ note 2, make sure you have "import functools" in your code