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

Guido van Rossum guido at python.org
Mon Apr 28 21:08:40 CEST 2014


On Mon, Apr 28, 2014 at 11:42 AM, Paul Sokolovsky <pmiscml at gmail.com> wrote:

Well, it's easy to treat "object" class as a special-case, "null"
> class.


But the implementation doesn't, at least not for the question you're asking.


> So, let's re-formulate questions above with "where such
> native base classes are not 'object'".
>
> >
> > Basically, if two classes have compatible layouts, you can inherit
> > from both at once.
>
> How is "compatible layout" defined? Or "layout" for that matter at
> all?
>

The layout is what the C struct defining the object looks like. These are
typically defined in headers in the Include directory (e.g. listobject.h).

The definition of compatible layout is defined by the C code that gives the
error message when it's incompatible. Sorry, I don't recall exactly where
that is, so I recommend that you just look at CPython's source tree. (I
know you have a personal desire not to look at CPython, but I can't help
you without referring to it anyway.)

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140428/d5c9c3ae/attachment.html>


More information about the Python-Dev mailing list