User: Password:
Subscribe / Log in / New account

Refcounting and multiple inheritance

Refcounting and multiple inheritance

Posted Jul 12, 2011 3:29 UTC (Tue) by neilbrown (subscriber, #359)
In reply to: Refcounting and multiple inheritance by Auders
Parent article: Object-oriented design patterns in the kernel, part 2

> The standard CPython implementation of Python uses reference counting, and yet it supports multiple inheritance. How is this possible?

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.

(Log in to post comments)

Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds