# (in numbers.py probably, because it would otherwise be alone in its own module booleans.py) class Boolean(metaclass=ABCMeta): """ An abstract base class for booleans. """ __slots__ = () @abstractmethod def __bool__(self): """Return a builtin bool instance. Called for bool(self).""" @abstractmethod def __and__(self, other): """self & other""" @abstractmethod def __rand__(self, other): """other & self""" @abstractmethod def __xor__(self, other): """self ^ other""" @abstractmethod def __rxor__(self, other): """other ^ self""" @abstractmethod def __or__(self, other): """self | other""" @abstractmethod def __ror__(self, other): """other | self""" # register bool as a virtual subclass Boolean.register(bool)