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

相关文章
相关标签/搜索