From: Vivien Maisonneuve Date: Tue, 9 Sep 2014 09:02:20 +0000 (+0200) Subject: Make Expression.subs() always return a LinExpr instance X-Git-Tag: 1.0.2~1 X-Git-Url: https://scm.cri.ensmp.fr/git/linpy.git/commitdiff_plain/1044e58e639333d281d47739ba9ecef607ff14e6 Make Expression.subs() always return a LinExpr instance --- 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