summaryrefslogtreecommitdiff
path: root/python/settings.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2020-05-02 11:01:35 -0400
committerPeter LaFosse <peter@vector35.com>2020-05-03 13:20:56 -0400
commit8f1bc5944b849f3ad0cbbd5972d5ab9948ed4d57 (patch)
tree43b48da8a1ec93b148575bc3346059e5316e6bf6 /python/settings.py
parent5b84fdea8abcb4abba61d07e0d12b4115b516c52 (diff)
Fix up equality operators and had hash operators
Diffstat (limited to 'python/settings.py')
-rw-r--r--python/settings.py16
1 files changed, 8 insertions, 8 deletions
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 __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, value):
- if not isinstance(value, Settings):
- return True
- return ctypes.addressof(self.handle.contents) != ctypes.addressof(value.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)))