MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __eq__

Method __eq__

geometry/graham_scan.py:52–63  ·  view source on GitHub ↗

Check if two points are equal. >>> Point(1, 2) == Point(1, 2) True >>> Point(1, 2) == Point(2, 1) False

(self, other: object)

Source from the content-addressed store, hash-verified

50 self.y = float(y_coordinate)
51
52 def __eq__(self, other: object) -> bool:
53 """
54 Check if two points are equal.
55
56 >>> Point(1, 2) == Point(1, 2)
57 True
58 >>> Point(1, 2) == Point(2, 1)
59 False
60 """
61 if not isinstance(other, Point):
62 return NotImplemented
63 return self.x == other.x and self.y == other.y
64
65 def __lt__(self, other: Point) -> bool:
66 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected