O'Reilly logo
  • Sinan Okay thinks this is interesting:

(e.g., count in this file’s self-test code—a class attribute used as an instance counter). Inherited class attributes are attached to the class only, not copied down to instances.

If you ever do wish to include inherited attributes too, you can climb the __class__ link to the instance’s class, use the __dict__ there to fetch class attributes, and then iterate through the class’s __bases__ attribute to climb to even higher superclasses, repeating as necessary.


Cover of Learning Python, 5th Edition


I did not get that