AI engineering glossary · Python advanced
What is ABC (abstract base class)?
Abstract base class (also called ABC): A class that cannot be instantiated directly and defines methods subclasses must implement. Python's abc module supports it. It enforces a contract so every subclass offers a required interface. It is a way to guarantee that every concrete class provides certain methods.
Abstract base class: an example
class Model(ABC) with @abstractmethod predict() forces every subclass, like LinearModel, to implement predict().
Related terms
- abc module
- Interface
- Inheritance
- Polymorphism
More Python advanced terms
Where you learn it
Abstract base class is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.