class P:

    def __init__(self, x):
        print('init')
        self._x = x

    @property
    def x(self):
        print('get')
        return self._x

    @x.setter
    def x(self, x):
        print('set')
        if x < 0:
            self._x = 0
        elif x > 1000:
            self._x = 1000
        else:
            self._x = x

    def double(self):
        return self.x * 2

    def overwrite(self):
        self.x = 20
