From 76b34be3606823fde247f58a045e2ee029a972dc Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Fri, 10 May 2024 12:41:24 +0200 Subject: Reintroduce __truediv__ for int and float types --- polymatrix/expression/expression.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/polymatrix/expression/expression.py b/polymatrix/expression/expression.py index abe37aa..415f16f 100644 --- a/polymatrix/expression/expression.py +++ b/polymatrix/expression/expression.py @@ -99,6 +99,12 @@ class Expression(ExpressionBaseMixin, ABC): def __sub__(self, other): return self + (-other) + def __truediv__(self, other): + if not isinstance(other, float | int): + return NotImplemented + + return (1 / other) * self + @abstractmethod def copy(self, underlying: ExpressionBaseMixin) -> "Expression": ... -- cgit v1.2.1