"""
Test whether two linear expressions are equal.
"""
- return isinstance(other, LinExpr) and \
- self._coefficients == other._coefficients and \
- self._constant == other._constant
+ if isinstance(other, LinExpr):
+ return self._coefficients == other._coefficients and \
+ self._constant == other._constant
+ return NotImplemented
def __le__(self, other):
from .polyhedra import Le
return True
def __eq__(self, other):
- return self.sortkey() == other.sortkey()
+ if isinstance(other, Symbol):
+ return self.sortkey() == other.sortkey()
+ return NotImplemented
def asdummy(self):
"""