TypeError: multiple bases have instance lay-out conflict
Jeremy Hylton
jeremy at alum.mit.edu
Mon Aug 19 09:26:56 EDT 2002
"robin and jim" <robinjim at earthlink.net> wrote in message news:<4GQ79.11079$LO1.881271 at newsread2.prod.itd.earthlink.net>...
> The following 2 class definitions:
>
> class Spam(object):
> __slots__ = ['notes']
>
> class Eggs(Spam, dict):
> pass
>
> produce the following error concerning class Eggs:
>
> TypeError: multiple bases have instance lay-out conflict
>
> Could someone explain this error message and why the above Eggs class
> definition is prohibited.
The builtin type dict and a new-style class with slots both define
custom object layouts at the C level. The C layout of Spam has a
specific slot for the notes attribute, while the dict type has its
hashtable. There's not way to resolve this conflict, because the
layout of the C structs is fixed for each type.
Jeremy
More information about the Python-list
mailing list