From 8f1bc5944b849f3ad0cbbd5972d5ab9948ed4d57 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Sat, 2 May 2020 11:01:35 -0400 Subject: Fix up equality operators and had hash operators --- python/settings.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'python/settings.py') diff --git a/python/settings.py b/python/settings.py index 447604c5..3b92ec5d 100644 --- a/python/settings.py +++ b/python/settings.py @@ -80,15 +80,15 @@ class Settings(object): if self.handle is not Settings.handle and self.handle is not None: core.BNFreeSettings(self.handle) - def __eq__(self, value): - if not isinstance(value, Settings): - return False - return ctypes.addressof(self.handle.contents) == ctypes.addressof(value.handle.contents) - - def __ne__(self, value): - if not isinstance(value, Settings): - return True - return ctypes.addressof(self.handle.contents) != ctypes.addressof(value.handle.contents) + def __eq__(self, other): + if not isinstance(other, self.__class__): + return NotImplemented + return ctypes.addressof(self.handle.contents) == ctypes.addressof(other.handle.contents) + + def __ne__(self, other): + if not isinstance(other, self.__class__): + return NotImplemented + return not (self == other) def __hash__(self): return hash((self.instance_id, ctypes.addressof(self.handle.contents))) -- cgit v1.3.1