有没有办法根据它们的继承检查python类而不实例化它?
class Base(object):
pass
class slaveA(Base):
pass
class slaveB(Base):
pass
def test(a):
# that's not correct
return type(slaveA) == type(a)
if __name__ == '__main__':
print(test(slaveB)) # should be False
print(test(slaveA)) # should be True
print(test(Base)) # should be True