node class these two structures rely on different node definitionsand by nesting those within the respective container classeswe avoid ambiguity another advantage of one class being nested as member of another is that it allows for more advanced form of inheritance in which subclass of the outer class overrides the definition of its nested class we will make use of that technique in section when specializing the nodes of tree structure dictionaries and the slots declaration by defaultpython represents each namespace with an instance of the built-in dict class (see section that maps identifying names in that scope to the associated objects while dictionary structure supports relatively efficient name lookupsit requires additional memory usage beyond the raw data that it stores (we will explore the data structure used to implement dictionaries in python provides more direct mechanism for representing instance namespaces that avoids the use of an auxiliary dictionary to use the streamlined representation for all instances of classthat class definition must provide class-level member named slots that is assigned to fixed sequence of strings that serve as names for instance variables for examplewith our creditcard classwe would declare the followingclass creditcardslots _customer _bank _account _balance _limit in this examplethe right-hand side of the assignment is technically tuple (see discussion of automatic packing of tuples in section when inheritance is usedif the base class declares slots subclass must also declare slots to avoid creation of instance dictionaries the declaration in the subclass should only include names of supplemental methods that are newly introduced for exampleour predatorycreditcard declaration would include the following declarationclass predatorycreditcard(creditcard)slots _apr in addition to the inherited members we could choose to use the slots declaration to streamline every class in this book howeverwe do not do so because such rigor would be atypical for python programs with that saidthere are few classes in this book for which we expect to have large number of instanceseach representing lightweight construct for examplewhen discussing nested classeswe suggest linked lists and trees as data structures that are often comprised of large number of individual nodes to promote greater efficiency in memory usagewe will use an explicit slots declaration in any nested classes for which we expect many instances