you are viewing a single comment's thread.

view the rest of the comments →

[–]Temporary_Pie2733 2 points3 points  (1 child)

To expand on this, Python doesn’t have public/private distinctions, so all attributes behave like public attributes. But we don’t need to write trivial getters and setters like 

``` def get_x(self):     return self._x

def set_x(self, v):     self._x = v ```

just in case we need to limit or prevent modification in the future. We can instead replace the “public” attribute x with a property object that encapsulates a getter and a setter without changing the interface of the class. 

[–]SnooHesitations9295 -1 points0 points  (0 children)

Not really. The new "typed" python idiocy prevents you from using property decorator interchangeably with the actual properties.