class A(object):
    def __init__(self):
        self.__dict__['a'] = 1
        self.b = 2
        
    @property
    def b(self):
        print 'b.getter'
        return self.__dict__['b']
    
    @b.setter
    def b(self, x):
        print 'b.setter'
        self.b = b
        
    def __setattr__(self, name, value):
        print 'setattr', name, value
        self.__dict__[name] = value
        
    def __getattr__(self, name):
        print 'getattr', name
        return super(A, self).__getattr__(name)
        
a = A()
a.b = 3
print a.b
a.a = 4
print a.a
Output:

setattr b 2
setattr b 3
b.getter
3
setattr a 4
4

Priority:

  • getter > getattr
  • setattr > setter