
Alex K. answered 10/19/19
Expert in high-level math, statistics, finance, economics
To answer this, we should revisit what a class is in Python.
A class is a template from which objects are created, with an object being:
1) a single number;
2) a dictionary, array, list, set, tuple;
3) a data frame comprised of one or numerous data types;
4) a procedure or function;
5) many other possible objects
A metaclass is a template from which other classes are created.
Think of a metaclass as a ‘class factory’.
Why use metaclasses?
Since metaclasses can create classes virtually simutaneously, and since classes create objects, you should think of the metaclasses as creating objects in a more effective way than creating one class at a time.
Benefits of creating multiple classes at virtually the same time and allowing the class-created objects to have numerous interactions enables various computational methods to be applied to complex data sets in ways not possible until quite recently