title: Python: __slots__ and its usage of descriptors
body: <pre><code>class Foo(object):
      __slots__ = ('a',)
  
  class Bar(Foo):
      @property
      def a(self):
          return super(Bar, self).a
  
   super(Bar, Bar()).a = 4
  </code></pre>
  
  <p>If I'm using this code, this doesn't work:</p>
  
  <pre><code>&gt;&gt;&gt; super(Bar, Bar()).a = 4
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  AttributeError: 'super' object has no attribute 'a'
  </code></pre>
  
  <p>Why?</p>
  
  <p>According to the <a href="http://docs.python.org/2/reference/datamodel.html?highlight=__slots__#__slots__" rel="nofollow">python docs</a>, <code>__slots__</code> are implemented :</p>
  
  <blockquote>
    <p><code>__slots__</code> are implemented at the class level by creating descriptors (Implementing Descriptors) for each variable name. As a result, class
    attributes cannot be used to set default values for instance variables
    defined by <code>__slots__</code>; otherwise, the class attribute would overwrite
    the descriptor assignment.</p>
  </blockquote>
  
  <p>But descriptors can cope with inheritance (at least if written in pure python).</p>
  
  <p>Does anyone get know, why this is not working with <code>__slots__</code>?</p>
  
  <p><strong>Edit</strong>: It seems like descriptors are generally not working with <code>super()</code>, if you're trying to write (read works, though). So my question would rather be: Why are descriptors read-only, if invoked with <code>super()</code>?</p>