类继承和内置的issubclass()

  |   0 评论   |   0 浏览   |   给我丶鼓励
# 您可以使用内置的“issubclass()”检查类继承关系

>>> class BaseClass: pass
>>> class SubClass(BaseClass): pass

>>> issubclass(SubClass, BaseClass)
True
>>> issubclass(SubClass, object)
True
>>> issubclass(BaseClass, SubClass)
False

标题:类继承和内置的issubclass()
作者:给我丶鼓励
地址:https://blog.doiduoyi.com/articles/1606620055936.html

评论

发表评论