__class__ class' class is type notice especially the last two lines here--classes are instances of the type classjust as normal instances are instances of user-defined class this works the same for both built-ins and user-defined class types in in factclasses are not really separate concept at allthey are simply user-defined typesand type itself is defined by class in python xthings work similarly for new-style classes derived from objectbecause this enables class behavior (as we've seen adds object to the __bases__ superclass tuple of top-level root classes automatically to qualify them as new-style) :\codepy - class (object)pass (in new-style classesclasses have class too type(xx __class__ type(cc __class__ classic classes in are bit differentthough--because they reflect the original class model in older pythonsthey do not have __class__ linkand like built-in types in they are instances of typenot type class ( 've shortened some of the hex addresses in object displays in this for clarity) :\codepy - class cpass (in classic classesclasses have no class themselves type(xx __class__ type(cc __class__ attributeerrorclass has no attribute '__class__metaclasses are subclasses of type why would we care that classes are instances of type class in xit turns out that this is the hook that allows us to code metaclasses because the notion of type is the same as class todaywe can subclass type with normal object-oriented techniques and class syntax to customize it and because classes are really instances of the type class metaclasses