Commit 8d6d5521 authored by Patrick Grinaway's avatar Patrick Grinaway
Browse files

Check type in __eq__() and __ne__(), simplify code

parent 1f1a28b5
...@@ -91,14 +91,14 @@ class BaseDimension(object): ...@@ -91,14 +91,14 @@ class BaseDimension(object):
return 'BaseDimension("%s")' % self.name return 'BaseDimension("%s")' % self.name
def __eq__(self, other): def __eq__(self, other):
if self._index == other._index: if isInstance(other, BaseDimension):
return True return self._index == other._index
return False return False
def __ne__(self, other): def __ne__(self, other):
if self._index == other._index: if isInstance(other, BaseDimension):
return False return self._index != other._index
return True return False
# run module directly for testing # run module directly for testing
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment