Diamond inheritance with str

Lulu of the Lotus-Eaters mertz at gnosis.cx
Mon Jun 16 16:21:15 EDT 2003


Patrick Earl <patrick at cs.ualberta.ca> wrote previously:
|>>> class A(str): pass
|...
|>>> class B(str): pass
|...
|>>> class C(A,B): pass
|...
|Traceback (most recent call last):
|  File "<stdin>", line 1, in ?
|TypeError: multiple bases have instance lay-out conflict

Likewise:

  >>> class A(tuple): pass
  ...
  >>> class B(tuple): pass
  ...
  >>> class C(A,B): pass
  ...
  Traceback (most recent call last):
    File "<stdin>", line 1, in ?
  TypeError: multiple bases have instance lay-out conflict

I imagine that you could do some clever checks in a metaclass (as
usual), but it feels to me also like that shouldn't be necessary.

--
---[ to our friends at TLAs (spread the word) ]--------------------------
Echelon North Korea Nazi cracking spy smuggle Columbia fissionable Stego
White Water strategic Clinton Delta Force militia TEMPEST Libya Mossad
---[ Postmodern Enterprises <mertz at gnosis.cx> ]--------------------------






More information about the Python-list mailing list