Prevent / alter access to class variables [duplicate]
This question already has answers here : Class-level read-only properties in Python (3 answers) Closed 3 years ago . Is there a way to prevent or alter access to class variables in Python as one can via overriding __setattr__ for instance variables? Note that this question is mistitled and actually refers to instance variables, not class variables. Based on reading multiple posts about the (apparent) deathtrap that is __slots__ , I'd prefer not to go that route (and I haven't looked into it enough to know if it does what I'm asking). Example: class A(object): foo = "don't change me" def _