Skip to content

Commit

Permalink
Remove the use of __cmp__ and use __eq__ instead
Browse files Browse the repository at this point in the history
Signed-off-by: Qin Zhang (张琴) <[email protected]>
  • Loading branch information
qinz0822 committed Nov 27, 2023
1 parent c0f32bd commit a6ba7c1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions XSConsoleHotData.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,16 @@ def __init__(self, inOpaqueRef, inType):
def __repr__(self):
return str(self.__dict__)

# __hash__ and __cmp__ allow this object to be used as a dictionary key
# __hash__ and __eq__ allow this object to be used as a dictionary key
def __hash__(self):
return self.hash

def __cmp__(self, inOther):
def __eq__(self, inOther):
if not isinstance(inOther, HotOpaqueRef):
return 1
return False
if self.opaqueRef == inOther.opaqueRef:
return 0
if self.opaqueRef < inOther.opaqueRef:
return -1
return 1
return True
return False

def OpaqueRef(self): return self.opaqueRef
def Type(self): return self.type
Expand Down

0 comments on commit a6ba7c1

Please sign in to comment.