Jan-11-2024, 11:36 AM
hi
the below code is in:https://realpython.com/python-mutable-vs...om-classes
thanks
the below code is in:https://realpython.com/python-mutable-vs...om-classes
class Point:
def __init__(self, x, y):
self._x = x
self._y = y
@property
def x(self):
return self._x
@property
def y(self):
return self._y
def __repr__(self):
return f"{type(self).__name__}(x={self.x}, y={self.y})"what does the last line do also what does the __repe__ method do? how can i use the __repr__ method? if it is omitted, does it cause any problems?thanks
