class Foo: pass print(type(int)) # <class ‘type‘> print(type(str)) # <class ‘type‘> print(type(Foo)) # <class ‘type‘> print(type(object)) # <class ‘type‘> print(type(type)) # <class ‘type‘> print(int.__bases__) # (<class ‘object‘>,) print(str.__bases__) # (<class ‘object‘>,) print(Foo.__bases__) # (<class ‘object‘>,) print(object.__bases__) # () print(type.__bases__) # (<class ‘object‘>,)
object是最顶层类;
type也是一个类,同时也是一个对象;它是用来生成类的。
原文地址:https://www.cnblogs.com/believepd/p/10777153.html
时间: 2024-10-25 10:50:13