class Rectangle:
__slots__ = '__width', '__height'
def __init__(self, a, b):
self.width = a
self.height = b
@property
def width(self):
return self.__width
@width.setter
def width(self, value):
if value <= 0:
raise ValueError("Width must be positive")
print('setter called')
self.__width = value
@property
def height(self):
return self.__height
@height.setter
def height(self, value):
if value <= 0:
raise ValueError("Height must be positive")
self.__height = value
class Rectangle:
__slots__ = '__widht', 'height'
def __init__(self, a, b):
self.widht = a
self.height = b
@property
def widht(self):
return self.__widht
@widht.setter
def widht(self, value):
print('setter called')
self.widht = value
где я туплю?