Python Professional — Hard
Key points
- __init_subclass__ is a lightweight alternative to metaclasses
- It is called on the parent class when a subclass is created
- Metaclasses are more powerful and can perform deeper customizations
- __init_subclass__ is sufficient for basic registration and validation tasks
Ready to go further?
Related questions
