projects
/
linpy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve representation of Constants
[linpy.git]
/
pypol
/
linear.py
diff --git
a/pypol/linear.py
b/pypol/linear.py
index
8fdece9
..
e6d442e
100644
(file)
--- a/
pypol/linear.py
+++ b/
pypol/linear.py
@@
-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):