python 中的type

1. type(object) -> the object's type

返回的是object的类型,即对象的类定义

例如:用元类动态生成子类
metaclass = type(father)  # 获取father的元类
subclass = metaclass(name, (father,), attrs)



type(name, bases, dict) -> a new type


返回一个类的定义




原文地址:https://www.cnblogs.com/mhc-fly/p/8521565.html