class MyType(type): def __init__(self, a, b, c): print('元类构造函数执行') def __call__(self, *args, **kwargs): obj = object.__new__(self) self.__init__(obj, *args, **kwargs) return objclass Foo(metaclass=MyType): def __init__(self, name): self.name = nameprint(Foo)f = Foo('alex')