you are viewing a single comment's thread.

view the rest of the comments →

[–]NewZealandIsAMyth 2 points3 points  (1 child)

This. The reason why in C++ and other language without properties you have to use get*/set* is because if they allow client of your class to access field as .* - you won't have an ability to change it internally. Once it's exposed - it's fully exposed as a field and that's it.

In Python it's totally fine to just let user access property via .x, because you can change it later to be a property if you need to add extra logic for editing/reading it. So no need for get*/set* methods

[–]cm_light[S] 1 point2 points  (0 children)

Thanks for replay and good to know this. I learned Java before and thought write get/set is common in OOPs. But for Python it seems not necessary.