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

For any instance z, any object x, and any identifier S (except __class__ and __dict__), z.S=x is equivalent to z.__dict__['S']=x (unless a __setattr__ special method, or an overriding descriptor’s __set__ special method, intercepts the binding attempt). For example, again referring to the z we just created:


Cover of Python in a Nutshell, 3rd Edition


assignment to an attribute on an object always can be intercepted by set, setattribute, or descriptor.