O'Reilly logo
  • Chris Kang thinks this is interesting:

Instance object z now has an attribute named x, bound to the value 23, and z.x refers to that attribute. Note that the __setattr__ special method, if present, intercepts every attempt to bind an attribute. (We cover __setattr__ in Table 4-1.) When you attempt to bind on an instance an attribute whose name corresponds to an overriding descriptor in the class, the descriptor’s __set__ method intercepts the attempt: should C7.x be an overriding descriptor, the assignment z.x=23 would execute ...


Cover of Python in a Nutshell, 3rd Edition


Note that setattr_ is an object methods whereas __set is a class method.