all this could be simplified by returning ``va - vb`` or ``vb - va`` depending on the direction (and the direction can be checked outside the sorting when creating the function instead of checking it for each compared element).
The comparison function does not need to return ``-1``, ``0`` or ``1`` only. any positive or negative number will do the work