class HideX(object): def __init__(self, x): self.x = x def get_x(self): return ~self.__x def set_x(self, x): assert isinstance(x, int), '"x" must be an integer!' self.__x = ~x x = property(get_x, set_x)inst = HideX(20)print inst.xinst.x = 30print inst.x
Name (required)
email (will not be published) (required)
Website