title: How to create a read-only class property in Python?
body: <p>Essentially I want to do something like this:</p>
  
  <pre><code>class foo:
      x = 4
      @property
      @classmethod
      def number(cls):
          return x
  </code></pre>
  
  <p>Then I would like the following to work:    </p>
  
  <pre><code>&gt;&gt;&gt; foo.number
  4
  </code></pre>
  
  <p>Unfortunately, the above doesn't work. Instead of given me <code>4</code> it gives me <code>&lt;property object at 0x101786c58&gt;</code>. Is there any way to achieve the above?</p>