python学习日记(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)
上一篇:3.linux man手册


下一篇:Mac SVN 设置代理(Proxy)并 Checkout 代码