projects
/
linpy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
b77f3f4
)
Make Expression.subs() always return a LinExpr instance
author
Vivien Maisonneuve
<v.maisonneuve@gmail.com>
Tue, 9 Sep 2014 09:02:20 +0000
(11:02 +0200)
committer
Vivien Maisonneuve
<v.maisonneuve@gmail.com>
Tue, 9 Sep 2014 09:08:10 +0000
(11:08 +0200)
linpy/linexprs.py
patch
|
blob
|
history
diff --git
a/linpy/linexprs.py
b/linpy/linexprs.py
index
3c00f22
..
f361218
100644
(file)
--- a/
linpy/linexprs.py
+++ b/
linpy/linexprs.py
@@
-306,7
+306,7
@@
class LinExpr:
for symbol in substitutions:
if not isinstance(symbol, Symbol):
raise TypeError('symbols must be Symbol instances')
- result =
self._constant
+ result =
Rational(self._constant)
for symbol, coefficient in self._coefficients.items():
expression = substitutions.get(symbol, symbol)
result += coefficient * expression