In Python 3, sort()
has parameters key
and reverse
. If you're using a custom compare function, and it sorts on multiple items (per object), how do you individually do ascending or descending per item? In my case, the items are not numeric, so negating a value is not an option.
I don't see any syntactic way to do what I want, so I'm stuck. In Python 2, you could do it very easily, because the compare function returned -1
, 0
, +1
. Python 3 seems less flexible.