Make Expression.subs() always return a LinExpr instance
[linpy.git] / linpy / linexprs.py
index 3c00f22..f361218 100644 (file)
@@ -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