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