cmp_to_key()就是专门用于转化cmp参数到key参数的。cmp参数和key参数,是用于python内排序的参数,代表函数是sorted()和.sort()。这个cmp_to_key()函数就是用来python@2到python@3过度的一个临时产物。 from ...
safe_cmp provides functions for safely sorting and ordering any value in Python 3. In fancy math terms, safe_cmp implements a total ordering of all values in Python 3. There are many cases when it can ...