What are the Metaclasses in Python and when are they used??
In object-oriented programming, a metaclass is a class whose instances are classes.
Most of the time we are not using metaclasses, they are like black magic and usually for something complicated, but few cases where we use metaclasses are:
- Metaclasses propogate down the inheritance hierarchies. It will affect all the subclasses as well. If we have such situation, then we should use metaclasses.
- If we want to change class automatically, when it is created.
Got it. Thanks !!
A place for coders and developers to share, learn and grow together.