print('data:' datax meth( )this code has some oddities 'll explain in moment when runthoughall three redefined methods run in turn for spam as in the prior section this is again essentially what the type object does by defaultbut there' an additional metaclass call for the metaclass subclass (metasubclass?) :\codepy - metaclass py making metaclass in supermeta initsubmeta (,{'__init__'init class object['__doc__''__module__''__new__''__init__making class in supermeta callspam (,{'data' 'meth''__module__''__main__'in submeta newspam (,{'data' 'meth''__module__''__main__'in submeta initspam (,{'data' 'meth''__module__''__main__'init class object['__qualname__''__module__''__doc__''data''meth'making instance data this example is complicated by the fact that it overrides method invoked by builtin operation--in this casethe call run automatically to create class metaclasses are used to create class objectsbut only generate instances of themselves when called in metaclass role because of thisname lookup with metaclasses may be somewhat different than what we are accustomed to the __call__ methodfor exampleis looked up by built-ins in the class ( typeof an objectfor metaclassesthis means the metaclass of metaclassas we'll see aheadmetaclasses also inherit names from other metaclasses normallybut as for normal classesthis seems to apply to explicit name fetches onlynot to the implicit lookup of names for built-in operations such as calls the latter appears to look in the metaclass' classavailable in its __class__ link--which is either the default type or metaclass this is the same built-ins routing issue we've seen so often in this book for normal class instances the metaclass in submeta is required to set this linkthough this also kicks off metaclass construction step for the metaclass itself trace the invocations in the output supermeta' __call__ method is not run for the call to supermeta when making submeta (this goes to type instead)but is run for the sub meta call when making spam inheriting normally from supermeta does not suffice to coding metaclasses