X-Git-Url: https://svn.cri.mines-paristech.fr/git/linpy.git/blobdiff_plain/49fa0d574a20817712006d479549dd96ccfff652..5d2a146f1fa8ff16a9de6f35e74d59031fbcb575:/linpy/linexprs.py

diff --git a/linpy/linexprs.py b/linpy/linexprs.py
index 38fa7a1..492ea9e 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 Rational(self._coefficients.get(symbol, 0))
+        return self._coefficients.get(symbol, Fraction(0))
 
     __getitem__ = coefficient
 
@@ -131,15 +131,14 @@ class LinExpr:
         Iterate over the pairs (symbol, value) of linear terms in the
         expression. The constant term is ignored.
         """
-        for symbol, coefficient in self._coefficients.items():
-            yield symbol, Rational(coefficient)
+        yield from self._coefficients.items()
 
     @property
     def constant(self):
         """
         The constant term of the expression.
         """
-        return Rational(self._constant)
+        return self._constant
 
     @property
     def symbols(self):
@@ -179,9 +178,8 @@ class LinExpr:
         Iterate over the coefficient values in the expression, and the constant
         term.
         """
-        for coefficient in self._coefficients.values():
-            yield Rational(coefficient)
-        yield Rational(self._constant)
+        yield from self._coefficients.values()
+        yield self._constant
 
     def __bool__(self):
         return True