Abstract Base Class Modules

abc

Define abstract interfaces with ABC and abstractmethod; incomplete subclasses cannot be instantiated. Virtual subclass registration affects recognition but does not supply inherited method implementations.

Formal Syntax & Structure

python syntaxpython
abc

Return Value

module

Module object accessed through import.

Working Example

Example Snippetpython
import abcclass Shape(abc.ABC): @abc.abstractmethod def area(self): ...class Square(Shape): def area(self): return 9print(Square().area())
Python Reference