isinstance 类型判断,对象是否是由类实例化
print(type([]) is list) print(isinstance([],list)) #True #True
issubclass 类是否为子类
class Foo: pass class Bar(Foo): pass print(issubclass(Bar,Foo)) #True
print(type([]) is list) print(isinstance([],list)) #True #True
class Foo: pass class Bar(Foo): pass print(issubclass(Bar,Foo)) #True