summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-05-10 12:41:24 +0200
committerNao Pross <np@0hm.ch>2024-05-10 12:41:24 +0200
commit76b34be3606823fde247f58a045e2ee029a972dc (patch)
tree849a83e6a66d1f498e7c6b2cf7875c04ed8cb7fe
parentCheck for uniqueness of names in ExpressionState (diff)
downloadpolymatrix-76b34be3606823fde247f58a045e2ee029a972dc.tar.gz
polymatrix-76b34be3606823fde247f58a045e2ee029a972dc.zip
Reintroduce __truediv__ for int and float types
-rw-r--r--polymatrix/expression/expression.py6
1 files changed, 6 insertions, 0 deletions
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": ...