returns the expected new class object the function is simply catching the call that the type object' __call__ normally intercepts by defaultc:\codepy - metaclass py making class in metafuncspam (,{'data' 'meth''__module__''__main__'making instance data overloading class creation calls with normal classes because normal class instances can respond to call operations with operator overloadingthey can serve in some metaclass roles toomuch like the preceding function the output of the following is similar to the prior class-based versionsbut it' based on simple class--one that doesn' inherit from type at alland provides __call__ for its instances that catches the metaclass call using normal operator overloading note that __new__ and __init__ must have different names hereor else they will run when the meta instance is creatednot when it is later called in the role of metaclassa normal class instance can serve as metaclass too class metaobjdef __call__(selfclassnamesupersclassdict)print('in metaobj call'classnamesupersclassdictsep='\ 'class self __new__(classnamesupersclassdictself __init__(classclassnamesupersclassdictreturn class def __new__(selfclassnamesupersclassdict)print('in metaobj new'classnamesupersclassdictsep='\ 'return type(classnamesupersclassdictdef __init__(selfclassclassnamesupersclassdict)print('in metaobj init:'classnamesupersclassdictsep='\ 'print(init class object:'list(class __dict__ keys())class eggspass print('making class'class spam(eggsmetaclass=metaobj())data def meth(selfarg)return self data arg print('making instance' spam(print('data:' datax meth( ) metaclasses metaobj is normal class instance called at end of statement