class from which they are acquiredeven though they are not physically stored in the instance' __dict__ itselfmapattrs-slots pytest __slots__ attribute inheritance from mapattrs import mapattrstrace class (object)__slots__ [' '' '] class ( )__slots__ [' '' 'class ( ) class (bc) def __init__(self)self name 'bob' (trace(mapattrs(ibysource=true)alsotrace(mapattrs( )for explicitly new-style classes like those in this filethe results are the same under both and though adds an extra built-in name to the set the attribute names here reflect all those inherited by the instance from user-defined classeseven those implemented by slots defined at classes and stored in space allocated in the instancec:\codepy - mapattrs-slots py {['name'][' ']['__dict__''__doc__''__init__''__module__''__qualname__''__weakref__'' '][' '' ']['__slots__'' '' ']but we need to move ahead to understand the role of slots better--and understand why mapattrs must be careful to check to see if __dict__ is present before fetching itstudy this code for more insight for the prior tree listeryour next step might be to index the mapattrs function' bysource=true dictionary result to obtain an object' attributes during the tree sketch traversalinstead of (or perhaps in addition to?its current physical __dict__ scan you'll probably need to use getattr on the instance to fetch attribute valuesbecause some may be implemented as slots or other "virtualattributes at their source classesand fetching these at the class directly won' return the instance' value if code anymore herethoughi'll deprive readers of the remaining funand the next section of its subject matter new-style class changes