aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-03-04 18:16:08 +0100
committerNao Pross <np@0hm.ch>2024-03-04 23:33:18 +0100
commit07bb9a799d4d635f586e1809298b341cadeff962 (patch)
tree850729501a8b5f24119246fc41cf5ff0dd817aad
parentFix types (or, make mypy happier) (diff)
downloadmdpoly-07bb9a799d4d635f586e1809298b341cadeff962.tar.gz
mdpoly-07bb9a799d4d635f586e1809298b341cadeff962.zip
Fix __mro__ problem in inheritance
-rw-r--r--mdpoly/algebra.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/mdpoly/algebra.py b/mdpoly/algebra.py
index a9fc806..a2d2325 100644
--- a/mdpoly/algebra.py
+++ b/mdpoly/algebra.py
@@ -77,7 +77,7 @@ class ExprWithRepr(Expr, HasRepr, Protocol):
""" Expression that has a representation """
-class ReducibleExpr(HasRepr, Protocol):
+class ReducibleExpr(ExprWithRepr, Protocol):
""" Reducible Expression
Algebraic expression that can be written in terms of other (existing)
@@ -187,7 +187,7 @@ class Add(Expr, HasRepr):
return f"({self.left} + {self.right})"
-class Sub(Expr, ReducibleExpr):
+class Sub(ReducibleExpr):
""" Generic subtraction operator (no type check) """
@property
@@ -200,7 +200,7 @@ class Sub(Expr, ReducibleExpr):
def reduce(self) -> ExprWithRepr:
""" See :py:meth:`mdpoly.algebra.ReducibleExpr.reduce`. """
# return self.left + (-1 * self.right)
- return Add(self.left, Mul(self._constant(value=-1), self.right))
+ return Add(self.left, Mul(Const(value=-1), self.right))
def __repr__(self) -> str:
return f"({self.left} - {self.right})"
@@ -242,7 +242,7 @@ class Mul(Expr, HasRepr):
return f"({self.left} * {self.right})"
-class Exp(Expr, ReducibleExpr):
+class Exp(ReducibleExpr):
""" Generic exponentiation (no type check). """
@property
@@ -334,7 +334,7 @@ class PolyMul(Mul, PolyRingAlgebra):
@binary_operator(PolyRingAlgebra, PolyRingAlgebra)
-class PolyDiv(Expr, ReducibleExpr, PolyRingAlgebra):
+class PolyDiv(ReducibleExpr, PolyRingAlgebra):
""" Division of scalar polynomial by scalar. """
def reduce(self) -> ExprWithRepr: