class Foo(object): pass class Bar(Foo): pass # type() 函数用于验证类型 print(type(Foo()) == Foo) # True print(type(Bar()) == Foo) # False