missing 1 required positional argument
import math
def reversed_cmp(x,y):
if x > y:
return -1
if x < y:
return 1
return 0
print(sorted([23,42,1,424],key=reversed_cmp,reverse=True))
为什么会报
Traceback (most recent call last):
File "C:/Python34/filterdata.py", line 12, in <module>
print(sorted([23,42,1,424],key=reversed_cmp,reverse=True))
TypeError: reversed_cmp() missing 1 required positional argument: 'y'