Skip to content

Commit 138ab84

Browse files
Implement __lt__() for BaseNode (#115) (#170)
(cherry picked from commit 61a56cd) Co-authored-by: Huba Tuba <[email protected]>
1 parent 7205343 commit 138ab84

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

elastic_transport/_node/_base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ def path_prefix(self) -> str:
143143
def __repr__(self) -> str:
144144
return f"<{self.__class__.__name__}({self.base_url})>"
145145

146+
def __lt__(self, other: object) -> bool:
147+
if not isinstance(other, BaseNode):
148+
return NotImplemented
149+
return id(self) < id(other)
150+
146151
def __eq__(self, other: object) -> bool:
147152
if not isinstance(other, BaseNode):
148153
return NotImplemented

0 commit comments

Comments
 (0)