Python魔法 - MetaClass metaclass The class of a class. Class definitions create a class name, a class dictionary, and a list of base classes. The metaclass is responsible for taking those three arguments and creating the class. Most object oriented pro…
首先看下面的代码: # coding: utf-8 class Test(object): pass print Test.__class__ # type print Test.__base__ # object t = Test() print t.__class__ # Test print t.__class__.__class__ # type print Test.__class__.__class__.__class__ # type a = type('Foo', (), {})…