summaryrefslogtreecommitdiffstats
path: root/Doc/library/abc.rst
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-13 17:09:33 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-13 17:09:33 (GMT)
commitb67596d8157ef972d418e623a99c8462f485c4d6 (patch)
tree194ba5bc3fae07eaf4cf9e51197b7c8f6a114f30 /Doc/library/abc.rst
parent174bc1e309b5bde8602568f186f53d886aec757c (diff)
downloadcpython-b67596d8157ef972d418e623a99c8462f485c4d6.zip
cpython-b67596d8157ef972d418e623a99c8462f485c4d6.tar.gz
cpython-b67596d8157ef972d418e623a99c8462f485c4d6.tar.bz2
Issue #16049: add abc.ABC helper class.
Patch by Bruno Dupuis.
Diffstat (limited to 'Doc/library/abc.rst')
-rw-r--r--Doc/library/abc.rst18
1 files changed, 14 insertions, 4 deletions
diff --git a/Doc/library/abc.rst b/Doc/library/abc.rst
index 6f23596..75eaa30 100644
--- a/Doc/library/abc.rst
+++ b/Doc/library/abc.rst
@@ -12,9 +12,9 @@
--------------
This module provides the infrastructure for defining :term:`abstract base
-classes <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
-regarding a type hierarchy for numbers based on ABCs.)
+classes <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 regarding a type hierarchy for numbers based on ABCs.)
The :mod:`collections` module has some concrete classes that derive from
ABCs; these can, of course, be further derived. In addition the
@@ -23,7 +23,7 @@ a class or instance provides a particular interface, for example, is it
hashable or a mapping.
-This module provides the following class:
+This module provides the following classes:
.. class:: ABCMeta
@@ -127,6 +127,16 @@ This module provides the following class:
available as a method of ``Foo``, so it is provided separately.
+.. class:: ABC
+
+ A helper class that has :class:`ABCMeta` as metaclass. :class:`ABC` is the
+ standard class to inherit from in order to create an abstract base class,
+ avoiding sometimes confusing metaclass usage.
+
+ Note that :class:`ABC` type is still :class:`ABCMeta`, therefore inheriting
+ from :class:`ABC` requires usual precautions regarding metaclasses usage
+ as multiple inheritance may lead to metaclass conflicts.
+
The :mod:`abc` module also provides the following decorators:
.. decorator:: abstractmethod