[New-bugs-announce] [issue46814] Documentation for constructin abstract base classes is misleading

Josh A. Mitchell report at bugs.python.org
Mon Feb 21 03:25:45 EST 2022


New submission from Josh A. Mitchell <yoshanuikabundi at gmail.com>:

The docs for the abc[0] module states "With this class, an abstract base class can be created by simply deriving from ABC", and then gives an example of a class with no contents. This is not sufficient to construct an ABC; an ABC in Python additionally requires at least one abstract method. This can be demonstrated by executing the example code and instantiating it (ABCs cannot be instantiated) or calling the inspect.isabstract() function on it (returns False). The requirement is also (cryptically) explicated in the Implementation paragraph of the "The abc Module: an ABC Support Framework" section of PEP 3119[1]. This requirement of implementing an abstract method is not mentioned in the docs for the abc module or in the module's docstrings. An ABC with no abstract methods is sometimes used to mark a parent class that is not intended to be instantiated on its own, so this limitation of the Python implementation should be documented.

[0] https://docs.python.org/3.11/library/abc.html

[1] https://www.python.org/dev/peps/pep-3119/#the-abc-module-an-abc-support-framework

----------
assignee: docs at python
components: Documentation
messages: 413639
nosy: Yoshanuikabundi, docs at python
priority: normal
severity: normal
status: open
title: Documentation for constructin abstract base classes is misleading
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46814>
_______________________________________


More information about the New-bugs-announce mailing list