In Python, everything is an object, even the classes that create objects. You used a class to instantiate an object instance, but classes themselves are also instantiated behind the scenes. This mechanism is available to you as a programmer through the concept of metaclasses.
Metaclasses allow you to hook when classes are created, and this technique is what’s behind magical frameworks like Django and SQLAlchemy where class definitions have side effects that impact databases.
In this course you’ll learn about how:
- Everything really is an object, including classes themselves
- Classes instantiate objects and get instantiated themselves
- You can hook class instantiation with the metaclass argument
Metaclasses aren’t for the faint of heart, but they do allow you to do some magic. Plus, learning about them can help you understand what exactly happens behind the scenes when you instantiate a class.
- 7 Lessons
- Video Subtitles and Full Transcripts
- 2 Downloadable Resources
- Accompanying Text-Based Tutorial
- Q&A With Python Experts: Ask a Question
- Certificate of Completion
Related Learning Paths: