Diamond inheritance with str

Jeff Epler jepler at unpythonic.net
Mon Jun 16 21:52:51 CEST 2003

I don't understand why it fixes the problem, but if you write this
instead, it works:
>>> class A(str): pass
>>> class B(A): pass
>>> class C(A): pass
>>> class D(B, C): pass

The original case fails just like your message described:
>>> class B1(str): pass
>>> class C1(str): pass
>>> class D1(B1, B2): pass
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  TypeError: multiple bases have instance lay-out conflict

This is in Python 2.2.2.


More information about the Python-list mailing list