From b90f09da753f9c6b865d866bc4ef9097f1b763ac Mon Sep 17 00:00:00 2001 From: Vivien Maisonneuve Date: Tue, 19 Aug 2014 11:23:58 +0200 Subject: [PATCH] Make LinExpr.coefficient() always return a Fraction --- linpy/linexprs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linpy/linexprs.py b/linpy/linexprs.py index b2cec53..99ad4ec 100644 --- a/linpy/linexprs.py +++ b/linpy/linexprs.py @@ -122,7 +122,7 @@ class LinExpr: """ if not isinstance(symbol, Symbol): raise TypeError('symbol must be a Symbol instance') - return self._coefficients.get(symbol, 0) + return self._coefficients.get(symbol, Fraction(0)) __getitem__ = coefficient -- 2.20.1