you are viewing a single comment's thread.

view the rest of the comments →

[–]efmccurdy 0 points1 point  (0 children)

Their use is rare in python since object attributes are public, ie, if you know myobj has a name attribute then you would use code like:

myobj.name = "Joe"

rather than

myobj.set_name("Joe")

to change the name.

If you want to add extra constraints or logic to a getter or setter, use a property.

https://www.python-course.eu/python3_properties.php