title: Cannot inherit from multiple classes defining __slots__?
body: <p>A certain situation in Python recently alarmed me, and its reason is still not completely clear after a little research. The following class definitions appear to work flawlessly and will produce what is intended:</p>
  
  <pre><code>class A: __slots__ = 'a', 'b'
  class B(A): __slots__ = ()
  class C(A): __slots__ = ()
  class D(B, C): __slots__ = ()
  </code></pre>
  
  <p>These are four classes arranged in a diamond inheritance pattern. However, a somewhat similar pattern is not allowed. The following class definitions seem as though they should function the same as the first:</p>
  
  <pre><code>class B: __slots__ = 'a', 'b'
  class C: __slots__ = 'a', 'b'
  class D(B, C): __slots__ = ()
  
  Traceback (most recent call last):
    File "&lt;pyshell#74&gt;", line 1, in &lt;module&gt;
      class D(B, C): __slots__ = ()
  TypeError: multiple bases have instance lay-out conflict
  </code></pre>
  
  <p>However, a <code>TypeError</code> is raised in this example. So three questions arise: (1) Is this a bug in Python, considering the slot names? (2) What would justify such an answer? (3) <em>What is the best workaround?</em></p>
  
  <hr>
  
  <p><strong>References:</strong></p>
  
  <ul>
  <li><a href="http://mail.python.org/pipermail/python-list/2002-December/740850.html" rel="noreferrer">__slots__ and multiple inheritance</a> (with replies following)</li>
  <li><a href="http://bytes.com/topic/python/answers/576995-multiple-inheritance-__slots__" rel="noreferrer">Multiple inheritance and __slots__</a></li>
  <li><a href="https://groups.google.com/group/comp.lang.python/msg/0f2e859b9c002b28" rel="noreferrer">Don't use __slots__</a></li>
  <li><a href="http://www.velocityreviews.com/forums/t339645-multiple-inheritance-__slots__-problem.html" rel="noreferrer">Multiple Inheritance __slots__ problem</a></li>
  </ul>