Implement __ne__ for MangedObject

As per python docs, "There are no implied relationships among the comparison operators. The truth of x==y does not imply that x!=y is false. Accordingly, when defining __eq__(), one should also define __ne__() so that the operators will behave as expected"
  Hence, implementing __ne__ to enable '!='
This commit is contained in:
Tianhao He
2015-11-09 12:38:41 -08:00
parent ea7feddae6
commit b16ab957ec

View File

@@ -465,6 +465,9 @@ class ManagedObject(object):
self.__class__ == other.__class__ and \
self._serverGuid == other._serverGuid
def __ne__(self, other):
return not(self == other)
def __hash__(self):
return str(self).__hash__()