标签:init man int pre __init__ __call__ call rgs type
class MyType(type): def __init__(self, *args, **kwargs): print(‘init‘) super(MyType, self).__init__(*args, **kwargs) def __call__(self, *args, **kwargs): print(‘call‘) super(MyType, self).__call__(*args, **kwargs) class Girl(MyType(‘Man‘, (object,), {})):pass # 参数:由MyType创建出一个Man的类, print(type(Girl))
标签:init man int pre __init__ __call__ call rgs type
原文地址:https://www.cnblogs.com/ipigzhu/p/9374494.html