abstract method
An abstract method is a method in an abstract base class (ABC) that you mark as abstract rather than making it fully concrete.
You mark abstract methods with the @abstractmethod decorator from the abc module. You use them to define a common interface that all concrete subclasses must implement. If any abstract methods remain unimplemented in a subclass, Python prevents you from instantiating that class, helping you catch design mistakes early.
You can still provide a default implementation inside an abstract method. Subclasses must override it to become instantiable, but they can call super() to reuse the shared behavior.
Example
>>> from abc import ABC, abstractmethod
>>> class Animal(ABC):
... @abstractmethod
... def speak(self):
... """Return the sound this animal makes."""
... ...
...
>>> Animal()
Traceback (most recent call last):
...
TypeError: Can't instantiate abstract class Animal with abstract method speak
>>> class Dog(Animal):
... def speak(self):
... return "Woof!"
...
>>> Dog().speak()
'Woof!'
Related Resources
Tutorial
Implementing an Interface in Python
In this tutorial, you'll explore how to use a Python interface. You'll come to understand why interfaces are so useful and learn how to implement formal and informal interfaces in Python. You'll also examine the differences between Python interfaces and those in other programming languages.
For additional information on related topics, take a look at the following resources:
- Python Classes: The Power of Object-Oriented Programming (Tutorial)
- Object-Oriented Programming (OOP) in Python (Tutorial)
- Python Interfaces: Object-Oriented Design Principles (Course)
- Implementing an Interface in Python (Quiz)
- Inheritance and Internals: Object-Oriented Programming in Python (Course)
- Class Concepts: Object-Oriented Programming in Python (Course)
- Python Classes - The Power of Object-Oriented Programming (Quiz)
- Intro to Object-Oriented Programming (OOP) in Python (Course)
- Object-Oriented Programming (OOP) in Python (Quiz)
By Leodanis Pozo Ramos • Updated Dec. 11, 2025