025_反射
作者:互联网
1,isinstance和issubclass
isinstance(obj,cls)检查是否obj是否是类 cls 的对象
class Foo(object): pass obj = Foo() isinstance(obj, Foo)
issubclass(sub, super)检查sub类是否是 super 类的派生类
class Foo(object): pass class Bar(Foo): pass issubclass(Bar, Foo)
标签:反射,isinstance,obj,025,issubclass,pass,Foo,class 来源: https://www.cnblogs.com/eternity-twinkle/p/10608058.html