def is_equal(self, other): """Common subexpression eliminating equality predicate. When two (sub)expressions are equal, the children of one object are reassigned to the children of the other, so some duplicated subexpressions are eliminated. """ result = NodeBase.is_equal(self, other) if result: self.children = other.children return result