BadPython.com

Suggestion for "Using custom getters and setters"

Use the @property decorator
            
class MyClass:
    def __init__(self, x):
        self._x = x
        
    @property
    def x(self):
        return self._x
        
    @x.setter
    def x(self, new_x):
        self._x = new_x