if callable(attr):
    setattr(self, name, attr)

@property
def x(self):
    return self.__foo.x

def set_x(self, value):
    if isinstance(value, int) and value > 0:
        self.__foo.x = value
mutate_x = set_x
if __name__ == '__main__':
    main()
Prevent access to an instance variable from subclass, without affecting base class