I have been learning about @property decorators that replace getters and setters. A lot of people seems to prefer using @property over getters and setters.
Regardless of which is desirable, are they even needed most of the times? I feel that it is unnecessary or overkill to have @property for all internal variables especially when the variables are as simple as below. Shouldn't simple things be left simple if they work?
class Ex():
def __init__(self, value):
self.__x = value
@property
def x(self):
return self.__x
@x.setter
def x(self, value):
self.__x = value
I also don't think @property provides extra security (if at all needed) as people with intention can still access the variable. (._Ex__x)
Why should I use @property (when validation and future changes are not expected) and when should I not use them?