DEF XXX (): Pass @classmethod DEF yyy (): Pass the Test = type ( ' the Test ' , (), { ' num1 ' :. 1, ' num2 ' : 2 }) # inheritance test, and defines two methods Test2 type = ( ' Test2 ' , (the Test,), { ' XXX ' : XXX, ' yyy ' : yyy}) Print (30 * ' # ' ) Help (the Test) Help (Test2) Print (30 * ' #' ) Print (type) # essence, is a class type, not a function Print (the Test) class Test1 (): Pass ' '' used to create a dynamic class type, a first parameter: the class name of the second parameter: tuples, incoming parent class name for the third parameter: class attribute when actually calling class to create classes, essentially calling type, ie type is the metaclass ' '' # print two classes parent class, are type Print (the Test. __class__ ) Print (Test1. __class__ )