🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Python Intermediate

What is Python ABC Module?

The Abstract Base Classes module that enables defining interfaces and abstract methods that subclasses must implement.

The abc module provides infrastructure for defining abstract base classes in Python. Classes inheriting from ABC with methods decorated with @abstractmethod cannot be instantiated directly — subclasses must implement all abstract methods. This enforces interface contracts at instantiation time rather than at method call time. ABCs are used extensively in Python's standard library: collections.abc defines Iterable, Mapping, Sequence interfaces. Custom ABCs enable type checking with isinstance() and designing frameworks where plugins must implement specific methods. The __subclasshook__ method allows virtual subclass registration without actual inheritance.

Related Terms

FastAPI
A modern, high-performance Python web framework for building APIs with automatic OpenAPI documentation and type validation.
Flask
A lightweight web framework for Python that provides essentials for building web applications without imposing structure.
Python Package
A directory containing Python modules and an __init__.py file, providing a way to organize and distribute reusable code.
Python Descriptors
Objects that define __get__, __set__, or __delete__ methods, controlling how attribute access works on other objects.
Decorator
A function that modifies or extends the behavior of another function or class without changing its source code.
Pip Requirements File
A text file listing Python package dependencies with version specifications for reproducible project installations.
View All Python Terms →