title: Python: Create Abstract Static Property within Class
body: <p>What I'd really like to do is something like this:</p>
  
  <pre><code>class X(metaclass=abc.ABCMeta):
      @abc.abstractAttribute # this doesn't exist
      var = [1,2]
  
  class Y(X):
      var = X.var + [3,4]
  </code></pre>
  
  <p>This would force any subclasses of <code>X</code> to implement a static <code>var</code> attribute.</p>
  
  <p>But there's no way to define a static attribute as abstract.</p>
  
  <p>Attempting to use @abc.abstractmethod, combined with property, I can get close:</p>
  
  <pre><code>class X(metaclass=abc.ABCMeta):
      @property
      @abc.abstractmethod
      def var(self):
          return [1,2]
  
  class Y(X):
      @property
      def var(self):
          return super().var + [3,4]
  </code></pre>
  
  <p><code>y=Y(); y.var</code> gives <code>[1,2,3,4]</code> as desired.</p>
  
  <p>But the goal is to create a static attribute/property, not an instance attribute/property.</p>
  
  <p>When creating as a @staticmethod:</p>
  
  <pre><code>class X(metaclass=abc.ABCMeta):
      @property
      @staticmethod
      @abc.abstractmethod
      def var():
          return [1,2]
  
  class Y(X):
      @property
      @staticmethod
      def var():
          return X.var + [3,4]
  </code></pre>
  
  <p>... then <code>y=Y(); y.var</code> gives <code>TypeError 'staticmethod' object is not callable</code></p>
  
  <p>If I switch the decorator order, this will resolve the staticmethod callable error:</p>
  
  <pre><code>class X(metaclass=abc.ABCMeta):
      @staticmethod
      @property
      @abc.abstractmethod
      def var():
          return [1,2]
  
  class Y(X):
      @staticmethod
      @property
      def var():
          return X.var + [3,4]
  </code></pre>
  
  <p>The static method will work, but the property will not function as intended: <code>y=Y(); y.var</code> returns the property itself, <code>&lt;property at 0x2c16aa1b3b8&gt;</code>.</p>
  
  <p><a href="https://stackoverflow.com/a/47448292">This answer</a> is close to what's desired, but it doesn't work in this case since the base class, <code>X</code>, will already have a <code>var</code> attribute (so subclass can access via super).</p>
  
  <p>How do you define a python class to have an abstract, static attribute/property?</p>