0
Python getters and setters
There are important right
1 Odpowiedź
+ 2
OOP in Python is really simplified compared to other languages, the encapsulation is much more loosely implemented, you can't make truly private variables. That's why getters and setters are not commonly used. If you want to add extra validation or special logic to getting/setting variables, then the best practice (the pythonic way) is to use property decorators above the specific functions:
@property
@varname.setter
https://www.sololearn.com/learn/Python/2472/