You can use a property:
class Example(object):
def __init__(self, value):
self._value = value
@property
def value(self):
return self._value
Note that the value with still be writable as example_object._value
, but prepending an underscore to an attribute name is a convention for telling other developpers this attribute is not part of the class public API and should not be used.