Abc
Abstract base classes (ABCs) define interfaces and enforce that subclasses implement required methods. Python's `abc` module provides the tools for creating ABCs and checking subclass relationships. The guide walks through ABC & abstractmethod, Concrete Methods in ABCs, Virtual Subclasses, __subclasshook__, ABCs in Collections. Subclass `ABC` and use `@abstractmethod` on methods that must be overridden: `class Shape(ABC): @abstractmethod; def area(self) -> float: ...`. Abstract classes cannot be instantiated. Subclasses that don't implement all abstract methods also remain abstract. ABCs can include concrete methods alongside abstract ones. Subclasses inherit concrete methods and can override them if needed. This pattern is useful for providing default behavior while requiring specific methods to be implemented. A class can be registered as a virtual subclass of an ABC without inheriting from it: `Shape.register(Circle)`. `isinstance(Circle(), Shape)` returns True, but `Circle` does not inherit `Shape` methods. Useful for adapting external classes to conform to an interface. The guide is organized into 5 sections that build on each other, each pairing a prose explanation with runnable code.