In other programming languages, class “inheritance” might not need much explanation: it’s generally about defining shared methods in a base class so that subclasses can use them directly. However, Python has an extra layer of complexity with its support for multiple inheritance, which allows a single class to inherit from multiple base classes. This makes things a bit more complicated. Well, maybe more than a bit—if you dive into the source code, it can get quite involved.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Class Inheritance in CPython

  • Chien-Lung Kao

摘要

In other programming languages, class “inheritance” might not need much explanation: it’s generally about defining shared methods in a base class so that subclasses can use them directly. However, Python has an extra layer of complexity with its support for multiple inheritance, which allows a single class to inherit from multiple base classes. This makes things a bit more complicated. Well, maybe more than a bit—if you dive into the source code, it can get quite involved.