[Python-Dev] Multiple inheritance from builtin (C) types [still] supported in Python3?
Paul Sokolovsky
pmiscml at gmail.com
Tue Apr 29 01:26:17 CEST 2014
Hello,
On Mon, 28 Apr 2014 12:08:40 -0700
Guido van Rossum <guido at python.org> wrote:
[]
> > 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.)
Well, sure I did, as I mentioned, but as that's first time I see that
code (that specific piece is in typeobject.c:extra_ivars()), it would
take quite some time be sure I understand all aspects of it. Thanks for
confirming that it's governed essentially by CPython implementation
details and not some language-level semantics like metaclasses (I
mentioned them because error message in Python2 did so, though Python3
doesn't refer to metaclasses).
An example would really help me to get a feel of the issue, but I
assume lack of them means that there's no well-known idiom where such
inheritance is used, and that's good enough on its own. I also tried to
figure how it's important to support such multi-base cases, so the code
I write didn't require complete rewrite if it hits one day, but
everything seems to turn out to be pretty extensible.
>
> --
> --Guido van Rossum (python.org/~guido)
Thanks!
--
Best regards,
Paul mailto:pmiscml at gmail.com
More information about the Python-Dev
mailing list