]> CRI, Mines Paris - PSL - linpy.git/blobdiff - pypol/linear.py
Improve representation of Constants
[linpy.git] / pypol / linear.py
index 8fdece9687e262fc08124f147616675c3a02aace..e6d442e454c4072fcc2addeca305e9846791c62b 100644 (file)
@@ -355,8 +355,11 @@ class Constant(Expression):
         return bool(self.constant)
 
     def __repr__(self):
         return bool(self.constant)
 
     def __repr__(self):
-        return '{}({!r})'.format(self.__class__.__name__, self._constant)
-
+        if self.constant.denominator == 1:
+            return '{}({!r})'.format(self.__class__.__name__, self.constant)
+        else:
+            return '{}({!r}, {!r})'.format(self.__class__.__name__,
+                self.constant.numerator, self.constant.denominator)
 
 class Symbol(Expression):
 
 
 class Symbol(Expression):