type object 和class 关系
#type->class->obj
类是由type元类生成的对象,由type生成了类对象,再有类对象生成了实例
tpye(int) -> class 'type'
tpye(1) -> class 'int'
1、object 是最顶层基类,object是type的实例,type继承于object,一切都是继承object
2、一切皆对象,type的实例是type,任何类都是type的实例,type是所有类的对象(实例),包括type类本身
type是所有类的对象(实例),包括type类本身
object是所有类的基类,object是type的实例,但type类继承object类
像int, str, list, tuple, set, bool, dict这些内置类都是type的实例
print(type(object)) #<class 'type'>
print(object.__bases__) #()
print(type(type)) # <class 'type'>
print(type.__bases__) # (<class 'object'>,)


浙公网安备 33010602011771号