def __xor__(self, other): if isinstance(other, (BaseMultiset, set, frozenset)): pass elif not isinstance(other, Set): return NotImplemented return self.symmetric_difference(other)