[Python-Dev] Multiple inheritance from builtin (C) types [still] supported in Python3?

Nick Coghlan ncoghlan at gmail.com
Wed Apr 30 06:22:26 CEST 2014


On 29 April 2014 21:38, Guido van Rossum <guido at python.org> wrote:
> When I redesigned and reimplemented this part of Python inheritance
> (somewhere in the 2.1 - 2.3 time frame, I forget the exact timing) I was
> well aware of the C++ approach and decided against it, preferring an
> approach requiring less compiler assistance that was easier for C
> programmers to use and understand. If as a Python programmer you want a more
> general multiple inheritance, you just shouldn't use slots. As a C
> programmer writing extension modules, the single-inheritance model (which
> this effectively is, at that level) is much easier to deal with.

Also related to the "single inheritance is easier to deal with when
writing C extensions" aspect, C extension code is also far more likely
than Python code to call the base class method implementations
directly - getting hold of super() objects from C to do cooperative
multiple inheritance isn't straightforward (I actually don't know how
to do it myself - I'd have to go trawling through the C API docs to
figure it out).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list