projects
/
linpy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add abstract class GeometricObject
[linpy.git]
/
pypol
/
linexprs.py
diff --git
a/pypol/linexprs.py
b/pypol/linexprs.py
index
a9f188b
..
5ec5efd
100644
(file)
--- a/
pypol/linexprs.py
+++ b/
pypol/linexprs.py
@@
-3,7
+3,7
@@
import functools
import numbers
import re
import numbers
import re
-from collections import OrderedDict, defaultdict
+from collections import OrderedDict, defaultdict
, Mapping
from fractions import Fraction, gcd
from fractions import Fraction, gcd
@@
-45,7
+45,7
@@
class Expression:
return Expression.fromstring(coefficients)
if coefficients is None:
return Rational(constant)
return Expression.fromstring(coefficients)
if coefficients is None:
return Rational(constant)
- if isinstance(coefficients,
dict
):
+ if isinstance(coefficients,
Mapping
):
coefficients = coefficients.items()
for symbol, coefficient in coefficients:
if not isinstance(symbol, Symbol):
coefficients = coefficients.items()
for symbol, coefficient in coefficients:
if not isinstance(symbol, Symbol):
@@
-218,7
+218,7
@@
class Expression:
def subs(self, symbol, expression=None):
if expression is None:
def subs(self, symbol, expression=None):
if expression is None:
- if isinstance(symbol,
dict
):
+ if isinstance(symbol,
Mapping
):
symbol = symbol.items()
substitutions = symbol
else:
symbol = symbol.items()
substitutions = symbol
else: