diff options
Diffstat (limited to 'Doc/library/abc.rst')
-rw-r--r-- | Doc/library/abc.rst | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/Doc/library/abc.rst b/Doc/library/abc.rst index aa1cc78..9fadbd2 100644 --- a/Doc/library/abc.rst +++ b/Doc/library/abc.rst @@ -7,6 +7,10 @@ .. sectionauthor:: Georg Brandl .. much of the content adapted from docstrings +**Source code:** :source:`Lib/abc.py` + +-------------- + This module provides the infrastructure for defining an :term:`abstract base class` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this was added to Python. (See also :pep:`3141` and the :mod:`numbers` module @@ -122,7 +126,7 @@ This module provides the following class: It also provides the following decorators: -.. function:: abstractmethod(function) +.. decorator:: abstractmethod(function) A decorator indicating abstract methods. @@ -157,6 +161,36 @@ It also provides the following decorators: multiple-inheritance. +.. decorator:: abstractclassmethod(function) + + A subclass of the built-in :func:`classmethod`, indicating an abstract + classmethod. Otherwise it is similar to :func:`abstractmethod`. + + Usage:: + + class C(metaclass=ABCMeta): + @abstractclassmethod + def my_abstract_classmethod(cls, ...): + ... + + .. versionadded:: 3.2 + + +.. decorator:: abstractstaticmethod(function) + + A subclass of the built-in :func:`staticmethod`, indicating an abstract + staticmethod. Otherwise it is similar to :func:`abstractmethod`. + + Usage:: + + class C(metaclass=ABCMeta): + @abstractstaticmethod + def my_abstract_staticmethod(...): + ... + + .. versionadded:: 3.2 + + .. function:: abstractproperty(fget=None, fset=None, fdel=None, doc=None) A subclass of the built-in :func:`property`, indicating an abstract property. |