simplerand which we'll omit here for space and timethis class is coded to keep its business as explicit as possiblethoughto maximize clarity for exampleyou could replace the __listclass method' loop statement in the first of the following with the implicitly run generator expression in the secondbut the second seems unnecessarily convoluted in this context--recursive calls embedded in generator expression--and has no obvious performance advantageespecially given this program' limited scope (neither alternative makes temporary listthough the first may create more temporary results depending on the internal implementation of stringsconcatenationand join--something you' need to time with ' tools to determine)or above 'for super in aclass __bases__above +self __listclass(superindent+ above 'joinself __listclass(superindent+ for super in aclass __bases__you could also code the else clause in __listclass like the followingas in the prior edition of this book--an alternative that embeds everything in the format arguments listrelies on the fact that the join call kicks off the generator expression and its recursive calls before the format operation even begins building up the result textand seems more difficult to understanddespite the fact that wrote it (never good sign!)self __visited[aclasstrue genabove (self __listclass(cindent+ for in aclass __bases__return '\ { }\nformatdotsaclass __name__id(aclass)self __attrnames(aclassindent)runs before format'join(genabove)dotsas alwaysexplicit is better than implicitand your code can be as big factor in this as the tools it uses also notice how this version uses the python and string format method instead of formatting expressionsin an effort to make substitutions arguably clearerwhen many substitutions are applied like thisexplicit argument numbers may make the code easier to decipher in shortin this version we exchange the first of the following lines for the secondreturn 'expression return 'formatmethod this policy has an unfortunate downside in and toobut we have to run the code to see why designing with classes