目录 isinstance和issubclass 反射(hasattr,getattr,setattr,delattr) isinstance和issubclass isinstance(obj,cls)检查obj是否是cls的对象,它会检查父类 class Foo: pass f = Foo() print(isinstance(f,Foo)) # f是Foo的实例化对象,所以打印True True class Foo(object): pass class Bar(Foo): pass pr…