Magicians aren’t supposed to reveal their secrets, but understanding metaclasses allows you to unravel the mystery for yourself. In this course, you’ve discovered the secret to several of Python’s greatest tricks, from class instantiation and object-relational mapping (ORM) models to
It’s worth noting that it isn’t typically necessary to create custom metaclasses. If you can solve the problem at hand in a simpler way, then you probably should. Still, it’s beneficial to understand metaclasses so that you understand Python classes in general and can recognize when a metaclass really is the appropriate tool to use.
- New-style classes
- Mike Fletcher’s slideshow on metaclasses
- PEP 3115: Metaclasses in Python 3000
- Build Enumerations of Constants With Python’s Enum
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.