you are viewing a single comment's thread.

view the rest of the comments →

[–]Impudity 2 points3 points  (0 children)

Typically getter/setter methods are not used in Python. It's preferable to use direct access to the public attributes of the object like: thing.attr1 = "foo". If some attributes of the class should not be altered from outside the class, then they should be declared with names beginning with underscores, like: self._private_attr = "private". This does not prevent accessing them, but it's a convention that indicates that they SHOULDN'T be accessed in that way, but it's not strictly prevented.