Abstract Base Classes

Learn what abstract base classes are in Python and how to use them.

What are Abstract Base Classes?

Duck typing is useful as it simplifies the code and the user can implement the functions without worrying about the data type. But this may not be the case all the time. The user might not follow the instructions to implement the necessary steps for duck typing. To cater to this issue, Python introduced the concept of abstract base classes, or ABC.

Abstract base classes define a set of methods and properties that a class must implement in order to be considered a duck-type instance of that class.

Why use abstract base classes?

Let’s look at see an example to understand why we should use abstract base classes.

Get hands-on with 1200+ tech skills courses.