Permalink
Browse files
add hash function for fofTypes
- Loading branch information...
Showing
with
5 additions
and
2 deletions.
-
+5
−2
fofTypes.py
|
@@ -13,7 +13,7 @@ def __eq__(self,other): |
|
|
return repr(self) == repr(other)
|
|
|
|
|
|
def __hash__(self):
|
|
|
- return int(repr(self))
|
|
|
+ return hash(self.op) ^ hash(self.term)
|
|
|
|
|
|
class BinaryOperand(object):
|
|
|
|
|
@@ -27,7 +27,7 @@ def __eq__(self,other): |
|
|
return repr(self) == repr(other)
|
|
|
|
|
|
def __hash__(self):
|
|
|
- return int(repr(self))
|
|
|
+ return hash(self.op) ^ hash(self.terms)
|
|
|
|
|
|
class Identifier(object):
|
|
|
|
|
@@ -40,6 +40,9 @@ def __repr__(self): |
|
|
def __eq__(self,other):
|
|
|
return repr(self) == repr(other)
|
|
|
|
|
|
+ def __hash__(self):
|
|
|
+ return hash(self.name)
|
|
|
+
|
|
|
class Quantor(object):
|
|
|
|
|
|
def __init__(self, string, variables, term):
|
|
|
0 comments on commit
7a48cf6