[Python-Dev] cpython: Issue #16049: add abc.ABC helper class. (original) (raw)

Georg Brandl g.brandl at gmx.net
Sun Dec 16 13:28:24 CET 2012


Am 13.12.2012 18:09, schrieb andrew.svetlov:

http://hg.python.org/cpython/rev/9347869d1066 changeset: 80840:9347869d1066 user: Andrew Svetlov <andrew.svetlov at gmail.com> date: Thu Dec 13 19:09:33 2012 +0200 summary: Issue #16049: add abc.ABC helper class.

Patch by Bruno Dupuis. files: Doc/library/abc.rst | 18 ++++++++++++++---- Lib/abc.py | 6 ++++++ Lib/test/testabc.py | 13 +++++++++++++ Misc/NEWS | 3 +++ 4 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/Doc/library/abc.rst b/Doc/library/abc.rst --- 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 (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 @@_ _hashable or a mapping._ _-This module provides the following class:_ _+This module provides the following classes:_ _.. class:: ABCMeta_ _@@ -127,6 +127,16 @@_ _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. +

Needs a versionadded.

Georg



More information about the Python-Dev mailing list