The standard CPython implementation of Python uses reference counting, and yet it supports multiple inheritance. How is this possible?
Refcounting and multiple inheritance
Posted Jul 12, 2011 3:29 UTC (Tue) by neilbrown (subscriber, #359) [Link]
A good question. I suspect that when you find the answer you will have a deeper understanding of inheritance.
I am not at all familiar with the CPython implementation or particularly familiar with multiple inheritance in Python so I cannot give a definitive answer. However as I noted in the introduction, "inheritance" does not seem to be a very well defined term, and "multiple inheritance" even less so. So the apparent contradiction could just be a confusion in the use of terms.
The short answer is simply that whatever CPython allows one class to inherit from multiple other classes, it cannot include the reference counters.
Copyright © 2016, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds