Metaclasses are classes or objects that define a type/class of other classes. Metaclasses can be classes, functions, or any object that supports calling an interface. There are notable differences in setting a metaclass in Python 2 and 3. This chapter discusses the concepts for maintaining compatibility when setting metaclasses.
Metaclasses at a Glance
As in other languages, Python classes are blueprints from which we create objects; however, borrowing from languages like Smalltalk, Python classes are much more interesting. Classes are also first-class objects whose class is a metaclass. ...