def setChild(self, which, t): """Overrides Traversable's setChild to enforce the rule that a child of an Expression must be type Expression""" if isinstance(t, Expression): Traversable.setChild(self, which, t) else: raise ChildNotAnExpressionError(str(type(t))) return self
def setChild(self, which, t): """Overrides the Traversable setChild to catch unsupported child nodes""" self._catchChildNotCorrectType(t) Traversable.setChild(self, which, t)