Python also has a property getter/setter mechanism:
class SomeClass:
def __init__(self):
self._abc = None
@property
def abc(self):
return self._abc
@abc.setter
def abc(self, value):
self._abc = value
obj = SomeClass()
obj.abc = 'test'
print(obj.abc) # "test"
But it's worth noting that this approach would make sense only if you need to control access to a protected property or to perform additional operations while getting or setting the value. Otherwise, it would be more straightforward to initialise a property in the constructor and use it directly:
class SomeClass:
def __init__(self):
self.abc = None
obj = SomeClass()
obj.abc = 'test'
print(obj.abc) # "test"
This tutorial should help you: https://www.python-course.eu/python3_properties.php.