摘要:
#isinstance(obj,cls)判断obj是否是类cls的实例 #issubclass(cls,cls1)判断cls是否是cls1的子类或派生类 class Foo: pass class Bar(Foo): pass print(issubclass(Bar,Foo))#检查sub类是否是super类的派生类 f1=Foo() print(isinstance... 阅读全文
摘要:
#isinstance(obj,cls)判断obj是否是类cls的实例 #issubclass(cls,cls1)判断cls是否是cls1的子类或派生类 class Foo: pass class Bar(Foo): pass print(issubclass(Bar,Foo))#检查sub类是否是super类的派生类 f1=Foo() print(isinstance... 阅读全文