Hi, recently I read some codes of others , and found the differences between others and mine is that they often write a function to get class member. Like
instead of just using
in the program.
I mean, in C++, I know the function of this is to get private member.
In python, though everything is set as public (in normal cases) ,
Why it has reason to be used in python? Is that just bad code?
Or something else I ignore?
I am kinda new to python, so I will appreciate it if you give some advice.
Similar Question It seems my question has been identified as the duplicate of another one. I checked the answer and found the answer of that is more like general advice instead of pythonic programming.
While the answer below introduces a feature of python -- property
That possibly cannot be learned from that question, so it's the reason I think my question is unique.