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.

Level: advancedTopic: Python advanced

Abstract base class: an example

class Model(ABC) with @abstractmethod predict() forces every subclass, like LinearModel, to implement predict().

Related terms

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.