don't need to implement comparison dunders for Coordinate anymore as it now behaves like a tuple which already includes useful comparators
All checks were successful
Publish to PyPI / Publish to PyPI (push) Successful in 1m11s

This commit is contained in:
Stefan Harmuth 2023-11-27 06:17:59 +01:00
parent 6ab6df1bc9
commit c2f6191d69

View File

@ -288,30 +288,6 @@ class Coordinate(tuple):
def __truediv__(self, other): def __truediv__(self, other):
return self // other return self // other
def __gt__(self, other):
if self.z is None:
return self.x > other.x and self.y > other.y
else:
return self.x > other.x and self.y > other.y and self.z > other.z
def __ge__(self, other):
if self.z is None:
return self.x >= other.x and self.y >= other.y
else:
return self.x >= other.x and self.y >= other.y and self.z >= other.z
def __lt__(self, other):
if self.z is None:
return self.x < other.x and self.y < other.y
else:
return self.x < other.x and self.y < other.y and self.z < other.z
def __le__(self, other):
if self.z is None:
return self.x <= other.x and self.y <= other.y
else:
return self.x <= other.x and self.y <= other.y and self.z <= other.z
def __str__(self): def __str__(self):
if self.z is None: if self.z is None:
return "(%d,%d)" % (self.x, self.y) return "(%d,%d)" % (self.x, self.y)