PHP
·
发表于 5年以前
·
阅读量:8292
>>> class Student():
def __init__(self,id,name):
self.id = id
self.name = name
>>> class Undergraduate(Student):
pass
# 判断 Undergraduate 类是否为 Student 的子类
>>> issubclass(Undergraduate,Student)
True
#第二个参数可为元组:
>>> issubclass(int,(int,float))
True