def _subs(self, old, new, **hints): if old.is_Conditioned and not old.lhs.is_boolean or new.is_Conditioned and not new.lhs.is_boolean: old = old.as_boolean() new = new.as_boolean() return Expr._subs(self, old, new, **hints)