projects
/
linpy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5d2a146
)
Fix Symbol == LinExpr comparisons
author
Vivien Maisonneuve
<v.maisonneuve@gmail.com>
Tue, 19 Aug 2014 09:29:04 +0000
(11:29 +0200)
committer
Vivien Maisonneuve
<v.maisonneuve@gmail.com>
Tue, 19 Aug 2014 12:35:41 +0000
(14:35 +0200)
linpy/linexprs.py
patch
|
blob
|
history
diff --git
a/linpy/linexprs.py
b/linpy/linexprs.py
index
492ea9e
..
e4ed1cc
100644
(file)
--- a/
linpy/linexprs.py
+++ b/
linpy/linexprs.py
@@
-247,9
+247,10
@@
class LinExpr:
"""
Test whether two linear expressions are equal.
"""
"""
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
def __le__(self, other):
from .polyhedra import Le
@@
-497,7
+498,9
@@
class Symbol(LinExpr):
return True
def __eq__(self, other):
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):
"""
def asdummy(self):
"""