From 1044e58e639333d281d47739ba9ecef607ff14e6 Mon Sep 17 00:00:00 2001 From: Vivien Maisonneuve Date: Tue, 9 Sep 2014 11:02:20 +0200 Subject: [PATCH] Make Expression.subs() always return a LinExpr instance --- linpy/linexprs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linpy/linexprs.py b/linpy/linexprs.py index 3c00f22..f361218 100644 --- 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 -- 2.20.1