class aa(object):
aa=5
class bb(aa):
bb=6
A = aa()
B = bb()
print("Is A instance of aa?: {}".format(isinstance(A, aa)))
print("Is B instance of aa?: {}".format(isinstance(B, aa)))
print("Is A instance of bb?: {}".format(isinstance(A, bb)))
print("Is aa is subclass of bb?: {}".format(issubclass(aa, bb)))
print("Is bb is subclass of aa?: {}".format(issubclass(bb, aa)))
Is A instance of aa?: True
Is B instance of aa?: True
Is A instance of bb?: False
Is aa is subclass of bb?: False
Is bb is subclass of aa?: True
댓글남기기