diff options
author | Nao Pross <np@0hm.ch> | 2024-05-10 12:41:24 +0200 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2024-05-10 12:41:24 +0200 |
commit | 76b34be3606823fde247f58a045e2ee029a972dc (patch) | |
tree | 849a83e6a66d1f498e7c6b2cf7875c04ed8cb7fe | |
parent | Check for uniqueness of names in ExpressionState (diff) | |
download | polymatrix-76b34be3606823fde247f58a045e2ee029a972dc.tar.gz polymatrix-76b34be3606823fde247f58a045e2ee029a972dc.zip |
Reintroduce __truediv__ for int and float types
-rw-r--r-- | polymatrix/expression/expression.py | 6 |
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": ... |