cmp_to_key
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import functools
def xy_compare(n1, n2):
if n1[1] > n2[1]:
return 1
elif n1[1] == n2[1]:
if n1[0] > n2[0]:
return 1
elif n1[0] == n2[0]:
return 0
else:
return -1
else:
return -1
src = [(0, 4), (1, 2), (1, -...
389 post articles, 49 pages.