When do I get "multiple bases have instance lay-out conflict" error?
Harish K Vishwanath
harish.shastry at gmail.com
Mon Sep 15 06:06:55 EDT 2008
Hello all,
When do we actually see the error :
TypeError: Error when calling the metaclass bases
multiple bases have instance lay-out conflict
I searched the web and I could not find a correct guideline as to when such
an error could arise. One of the places said that "A new style class cannot
inherit from more than one python built-in class". That is.,
>>> class A(dict,list):
... pass
wouldn't work.
But, I have an instance where I am getting the above error even when I dont
inherit from multiple built-in types.
>>> sys.__version__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute '__version__'
>>> sys.version
'2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)]'
Using Py 2.5.2
>>> import persistent
>>> persistent.Persistent.__bases__
(<type 'object'>,)
Persistent is ZOPE/ZODB implementation. It inherits no built-in types
>>> Exception.__bases__
(<type 'exceptions.BaseException'>,)
>>> BaseException.__bases__
(<type 'object'>,)
Exception also inherits no built-in types.
>>> class A(Exception,persistent.Persistent):
... pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Error when calling the metaclass bases
multiple bases have instance lay-out conflict
Still declaration of class A fails. Any idea? What is the exact rule when
python throws up " multiple bases have instance lay-out conflict" error?
Thanks in advance for the help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080915/ebd0b43b/attachment.html>
More information about the Python-list
mailing list