Python uses __name__ to identify the current module or class. For modules, it distinguishes code run directly from code imported elsewhere: a directly run module receives __main__, while an imported module receives its module name. section 8.7
if __name__ == '__main__':
Use the familiar guard to execute code only when a module runs directly, rather than when another module imports it. section 8.7
Identify a class dynamically
For an object, self.__class__.__name__ produces a string containing the object's current class name. This supports assigning class-based information without asking the user to provide it. section 9.27

