diff --git a/src/primitives.py b/src/primitives.py index 0b3d0be76d80b106b5630a68a3df89a099afa522..e5898005e76a4add64d7a84e5d19d5ee2e6c1a33 100644 --- a/src/primitives.py +++ b/src/primitives.py @@ -355,9 +355,9 @@ class Product(Expression): return NotImplemented if isinstance(other, Product): return Product(self.children + other.children) - if not other: + if is_zero(other): return 0 - if not other-1: + if is_zero(other-1): return self return Product(self.children + (other,)) @@ -366,9 +366,9 @@ class Product(Expression): return NotImplemented if isinstance(other, Product): return Product(other.children + self.children) - if not other: + if is_zero(other): return 0 - if not other-1: + if is_zero(other-1): return self return Product((other,) + self.children)