Python type class metaclass

'type' 是 python built-in metaclasspython

其餘繼承自 ‘type’的class均可以是 Metaclassui

子類能夠繼承父類的metaclassthis

然而 __metaclass__屬性不能繼承繼承

__metaclass__能夠定義成任何返回instance of 'type' callableit

 

 

__new__(cls, ...)  : create instance of clsclass

__init__(self, ...) :instance already created and set properties to this instancemeta

相關文章
相關標籤/搜索