projects
/
linpy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8332ae2
)
Symplify TypeError messages in Expression.__new__
author
Vivien Maisonneuve
<v.maisonneuve@gmail.com>
Sat, 12 Jul 2014 16:39:14 +0000
(18:39 +0200)
committer
Vivien Maisonneuve
<v.maisonneuve@gmail.com>
Sat, 12 Jul 2014 16:39:14 +0000
(18:39 +0200)
pypol/linexprs.py
patch
|
blob
|
history
diff --git
a/pypol/linexprs.py
b/pypol/linexprs.py
index
5ec5efd
..
b23eea8
100644
(file)
--- a/
pypol/linexprs.py
+++ b/
pypol/linexprs.py
@@
-65,14
+65,12
@@
class Expression:
if isinstance(coefficient, Rational):
coefficient = coefficient.constant
if not isinstance(coefficient, numbers.Rational):
if isinstance(coefficient, Rational):
coefficient = coefficient.constant
if not isinstance(coefficient, numbers.Rational):
- raise TypeError('coefficients must be rational numbers '
- 'or Rational instances')
+ raise TypeError('coefficients must be Rational instances')
self._coefficients[symbol] = coefficient
if isinstance(constant, Rational):
constant = constant.constant
if not isinstance(constant, numbers.Rational):
self._coefficients[symbol] = coefficient
if isinstance(constant, Rational):
constant = constant.constant
if not isinstance(constant, numbers.Rational):
- raise TypeError('constant must be a rational number '
- 'or a Rational instance')
+ raise TypeError('constant must be a Rational instance')
self._constant = constant
self._symbols = tuple(self._coefficients)
self._dimension = len(self._symbols)
self._constant = constant
self._symbols = tuple(self._coefficients)
self._dimension = len(self._symbols)