The simplest way I could think of, is to override the __setattr__
and raise an Error whenever the particular attribute is set, like this
class dummy(object):
def __init__(self, arg):
super(dummy, self).__setattr__("data", arg)
def __setattr__(self, name, value):
if name == "data":
raise AttributeError("Can't modify data")
else:
super(dummy, self).__setattr__(name, value)
a = dummy(5)
print a.data
# 5
a.data = "1"
# AttributeError: Can't modify data