Answer the question
In order to leave comments, you need to log in
What and when to use, property, descriptors or setter and getter?
Good afternoon!
I started learning OOP using Python as an example (I am learning it). I got to the classic setters and getters, then @property appeared and now descriptors. And the moment came when I asked the question, what the hell should I use and when? @property - there are chances to violate DRY, setter - the Python way is not recommended, then there are descriptors that are practically not used? And how to be? Is it possible to use only one technique?
p/s. I looked at python patterns and only @property is used there.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question