Python新手问题。
我运行以下示例:
class Polygon:
def __init__(polygonType):
print('Polygon is a ', polygonType)
class Triangle(Polygon):
def __init__(self):
Polygon.__init__('triangle')
print(issubclass(Triangle, Polygon))
print(issubclass(Triangle, list))
print(issubclass(Triangle, (list, Polygon)))
print(issubclass(Polygon, (list, Polygon)))
这是输出:
True
False
True
True
为什么最后两个print
语句会产生true
?它有任何实际意义还是只有理论意义?