From a7f4034d183aba9e67a8be344eb8997c182d4a97 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sat, 5 Dec 2009 20:31:12 -0500 Subject: [PATCH] Automatically simplify 0/(something) to 0. --- pymbolic/primitives.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pymbolic/primitives.py b/pymbolic/primitives.py index 49db90b..f194874 100644 --- a/pymbolic/primitives.py +++ b/pymbolic/primitives.py @@ -86,6 +86,8 @@ class Expression(object): if not is_valid_operand(other): return NotImplemented + if is_zero(other): + return 0 return quotient(other, self) __rtruediv__ = __rdiv__ -- GitLab