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

Categories

Python Intermediate

What is ABC (Abstract Base Class)?

A class that defines a common interface for subclasses by declaring abstract methods that must be implemented.

ABCs enforce contracts — subclasses must implement all abstract methods or they cannot be instantiated. Create ABCs using the abc module: class Shape(ABC): @abstractmethod def area(self): pass. Any subclass must define area().

ABCs are useful for plugin systems, framework extensions, and defining clear interfaces. Built-in ABCs include collections.abc (Iterable, Sequence, Mapping) which define what operations a collection supports.

Related Terms

FastAPI
A modern, high-performance Python web framework for building APIs with automatic OpenAPI documentation and type validation.
Decorator
A function that modifies or extends the behavior of another function or class without changing its source code.
Pickle
Python's built-in module for serializing and deserializing Python objects into a byte stream for storage or transmission.
Lambda Function
An anonymous, single-expression function defined inline using the lambda keyword.
GIL (Global Interpreter Lock)
A mutex in CPython that allows only one thread to execute Python bytecode at a time, limiting true parallelism.
Python Logging Best Practices
Structured approaches to implementing logging in Python applications using the built-in logging module for debugging and monitoring.
View All Python Terms →