@@ -10,6 +10,10 @@ def __init__(self, a, b, c, d):
1010 self .d = d
1111 def __repr__ (self ):
1212 return 'Point({!r:},{!r:},{!r:},{!r:})' .format (self .a , self .b , self .c , self .d )
13+ def __lt__ (self , other ):
14+ return (self .a < other .a if self .a != other .a else (self .b < other .b if self .b != other .b else (self .c < other .c if self .c != other .c else self .d < other .d )))
15+ def __gt__ (self , other ):
16+ return (self .a > other .a if self .a != other .a else (self .b > other .b if self .b != other .b else (self .c > other .c if self .c != other .c else self .d > other .d )))
1317 def distance (self , a , b , c , d ):
1418 return math .hypot (self .a - a , self .b - b , self .c - c , self .d - d )
1519
@@ -25,4 +29,6 @@ def distance(self, a, b, c, d):
2529 Point (1 , - 3 , - 2 , - 1 )
2630]
2731
28- print (sortingx .heap (points , key = methodcaller ('distance' , 0 , 0 , 0 , 0 )))
32+ print (sortingx .heap (points , key = methodcaller ('distance' , 0 , 0 , 0 , 0 )))
33+ # print(sortingx.merge(points))
34+ # print(sortingx.insert(points, reverse=True))
0 commit comments