add try in __eq__ for operator

This commit is contained in:
Benjamin Bertrand 2016-02-27 12:13:51 +03:00
parent 26e12370b8
commit 3530660c0b
1 changed files with 4 additions and 1 deletions

View File

@ -209,7 +209,10 @@ class Operator():
def __eq__(self, op2):
""" op1 == op2 """
return self.name == op2.name and self.arity == op2.arity
try:
return self.name == op2.name and self.arity == op2.arity
except AttributeError:
return False
def save_mainOp(obj, mainOp):
"""Create a temporary class build over built-in type to stock the main operation of a calculus