liveBook · Manning

Abstract method

An abstract method is a method declaration without a complete implementation that requires concrete subclasses or implementing types to provide one.

How 2 Manning books explain it

The Well-Grounded Python Developer: How the pros use Python and Flask

An abstract method is a method declaration that specifies an operation for subclasses without providing its implementation.

How it is used
Structures shape-rendering classes around shared behavior and subclass-specific drawing operations.
How deep it goes
Explains abstract declarations, non-instantiation, subclass implementation, and method overriding through a shape hierarchy.
Examples
Uses Shape, Rectangle, Square, and Circle classes in an onscreen drawing application.
What you can do after
Build it from scratch by separating shared shape behavior from subclass-specific drawing implementations.

Read how The Well-Grounded Python Developer: How the pros use Python and Flask explains abstract method →

Software Design for Python Programmers

The abstractmethod decorator marks a method as abstract so that concrete subclasses must implement it.

How it is used
Enforces implementation contracts while allowing abstract classes to share state and default behavior.
How deep it goes
Explains decoration, instantiation restrictions, inheritance, and duplicated algorithm drawbacks through worked Python examples.
Examples
Uses MotorVehicle, Car, Truck, and sports classes to demonstrate required methods, shared workflows, overrides, and duplicated algorithms.
What you can do after
Build it from scratch by declaring abstract methods with @abstractmethod and implementing every requirement in concrete subclasses.

Read how Software Design for Python Programmers explains abstract method →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.