# Old
class Foo(object):
def __init__(self):
self.x = 0
foo = Foo()
foo.x = 1
# New
class Foo(object):
def __init__(self):
self.__x = 0
@property
def x(self):
return self.__x
@x.setter
def x(self, val):
self.__x = val
do_other_stuff()