diff --git a/Doc/glossary.rst b/Doc/glossary.rst index a31bd53f06294d..f0934dc2e13877 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -29,9 +29,10 @@ Glossary Abstract base classes complement :term:`duck-typing` by providing a way to define interfaces when other techniques like :func:`hasattr` would be clumsy or subtly wrong (for example with - :ref:`magic methods `). ABCs introduce virtual - subclasses, which are classes that don't inherit from a class but are - still recognized by :func:`isinstance` and :func:`issubclass`; see the + :ref:`magic methods `). ABCs introduce + :term:`virtual subclasses `, which are classes that + don't inherit from a class but are still recognized by + :func:`isinstance` and :func:`issubclass`; see the :mod:`abc` module documentation. Python comes with many built-in ABCs for data structures (in the :mod:`collections.abc` module), numbers (in the :mod:`numbers` module), streams (in the :mod:`io` module), import finders @@ -1727,6 +1728,12 @@ Glossary A computer defined entirely in software. Python's virtual machine executes the :term:`bytecode` emitted by the bytecode compiler. + virtual subclass + A class that :func:`issubclass` and :func:`isinstance` treat as a + subclass of an :term:`abstract base class` even though it does not + inherit from it. A class is made a virtual subclass by registering + it with the ABC's :meth:`~abc.ABCMeta.register` method. + walrus operator A light-hearted way to refer to the :ref:`assignment expression ` operator ``:=`` because it looks a bit like a