码迷,mamicode.com
首页 > 其他好文 > 详细

1111

时间:2018-07-26 22:14:13      阅读:138      评论:0      收藏:0      [点我收藏+]

标签: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)) 

  

1111

标签:init   man   int   pre   __init__   __call__   call   rgs   type   

原文地址:https://www.cnblogs.com/ipigzhu/p/9374494.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!