__init_subclass__ - The Modern Alternative to Metaclasses
Master __init_subclass__ for subclass registration, definition-time validation, plugin registries, and keyword arguments in class statements - the Pythonic replacement for most metaclass use cases.
__set_name__ - The Descriptor Naming Protocol
Understand __set_name__, Python's descriptor self-naming protocol - how it eliminates name redundancy, how type.__new__ calls it, and how Django, Pydantic, and SQLAlchemy use it to build self-configuring field systems.
Custom ORM Core
Build a mini SQLAlchemy-style ORM using metaclasses, descriptors, and __set_name__ to map Python classes to database tables.
Descriptors - The Protocol That Powers Python's Object Model
Master the descriptor protocol - __get__, __set__, __delete__, data vs non-data descriptors, the complete attribute lookup algorithm, and how property, classmethod, staticmethod, and bound methods work under the hood.
Dynamic Class Creation - Building Classes at Runtime
Master the type() three-argument form, the full class creation pipeline, code generation with exec and compile, namedtuple internals, __prepare__, and building DSLs that generate Python classes at runtime.
Import Hooks and the Import System - Intercepting Module Loading
Master Python's import machinery - sys.meta_path finders, loaders, ModuleSpec, lazy imports, AST transformation on import, circular imports, and importlib.metadata for plugin discovery.
Metaclasses - The Class of Classes
Understand type as the metaclass of all classes, the full class creation pipeline, __new__, __init__, __call__ on metaclasses, __prepare__, metaclass inheritance and conflicts, and real-world usage in Django, SQLAlchemy, and ABC.
Module 01 - Metaprogramming Overview
Master the machinery that powers every serious Python framework - metaclasses, descriptors, __init_subclass__, __set_name__, dynamic class creation, and import hooks. Write code that writes code.
Plugin Framework
Build an auto-discovering plugin system using __init_subclass__, class registries, and import hooks.
Python __init_subclass__ Practice Problems & Exercises
Solve 11 Python __init_subclass__ problems. Covers __init_subclass__ practice, subclass hook. Hints and solutions.
Python __set_name__ Practice Problems & Exercises
Solve 11 Python __set_name__ problems (3 Easy, 4 Medium, 4 Hard). Practice __set_name__ practice, descriptor naming with hints, runnable code, and solutions.
Python Descriptors Practice Problems & Exercises
Solve 11 Python descriptors problems (3 Easy, 4 Medium, 4 Hard). Practice descriptor practice, __get__ __set__ with hints, runnable code, and solutions.
Python Dynamic Class Creation Practice Problems & Exercises
Solve 11 Python dynamic class creation problems. Covers dynamic class, type() exercises, class factory. Hints and solutions.
Python Import Hooks Practice Problems & Exercises
Solve 11 Python import hooks problems. Covers sys.meta_path exercises, custom finder, import system. Hints and solutions.
Python Metaclasses Practice Problems & Exercises
Solve 11 Python metaclasses problems. Covers metaclass practice, type() exercises, __new__ problems. Hints and solutions.