Dynamic Classes

Learn how to create classes with the type() function.

Custom metaclasses can modify classes by performing further actions or adding code. Usually, we do not require custom metaclasses, but sometimes they are necessary.

Dynamic creation of a class

In the previous lesson, we examined the types of different objects by passing a single argument to the type() function. That’s certainly not the end; this function can do much more. We can also create the classes using the type() function. Isn’t this amazing?

We can also call type() with three arguments:

 ...