Introduction

Learn about the concept of abstract base classes in Python.

Overview

We often need to distinguish between concrete classes with a complete set of attributes and methods, and an abstract class that is missing some details. This parallels the philosophical idea of abstraction as a way to summarize complexities. We might say that a sailboat and an airplane have a common, abstract relationship of being vehicles, but the details of how they move are distinct.

Possible approaches for similar items

In Python, we have two approaches to defining similar things:

  • Duck typing: When two class definitions have the same attributes and methods, then instances of the two classes have the ...