New submission from Josh A. Mitchell <yoshanuikabu...@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@python
components: Documentation
messages: 413639
nosy: Yoshanuikabundi, docs@python
priority: normal
severity: normal
status: open
title: Documentation for constructin abstract base classes is misleading
versions: Python 3.11

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46814>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to