Help on built-in function isinstance in module builtins:
isinstance(obj, class_or_tuple, /)
Return whether an object is an instance of a class or of a subclass thereof.
A tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to
check against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)
or ...`` etc.
isinstance() 是用来检测一个对象(类的实例)是否属于一个类(class)或者其子类:
isinstance(7, int)
Out[1]: True
这里要注意:
isinstance(object, type) # 当object作为一个对象的时候
Out[1]: True
isinstance(type, object) # 当type作为一个对象的时候
Out[2]: True