Discussion:
TypeError: multiple bases have instance lay-out conflict
Jeremy Hylton
2002-08-19 13:26:56 UTC
Permalink
__slots__ = ['notes']
pass
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
robin and jim
2002-08-18 17:18:56 UTC
Permalink
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.

Thanks.

Loading...