person person(lowercase for modules uppercase for classes alsokeep in mind that although classes and modules are both namespaces for attaching attributesthey correspond to very different source code structuresa module reflects an entire filebut class is statement within file we'll say more about such distinctions later in this part of the book classes can intercept python operators let' move on to the third and final major difference between classes and modulesoperator overloading in simple termsoperator overloading lets objects coded with classes intercept and respond to operations that work on built-in typesadditionslicingprintingqualificationand so on it' mostly just an automatic dispatch mechanism --expressions and other built-in operations route control to implementations in classes heretoothere is nothing similar in modulesmodules can implement function callsbut not the behavior of expressions although we could implement all class behavior as method functionsoperator overloading lets objects be more tightly integrated with python' object model moreoverbecause operator overloading makes our own objects act like built-insit tends to foster object interfaces that are more consistent and easier to learnand it allows class-based objects to be processed by code written to expect built-in type' interface here is quick rundown of the main ideas behind overloading operatorsmethods named with double underscores (__x__are special hooks in python classes we implement operator overloading by providing specially named methods to intercept operations the python language defines fixed and unchangeable mapping from each of these operations to specially named method such methods are called automatically when instances appear in built-in operations for instanceif an instance object inherits an __add__ methodthat method is called whenever the object appears in expression the method' return value becomes the result of the corresponding expression classes may override most built-in type operations there are dozens of special operator overloading method names for intercepting and implementing nearly every operation available for built-in types this includes expressionsbut also basic operations like printing and object creation there are no defaults for operator overloading methodsand none are required if class does not define or inherit an operator overloading methodit just means that the corresponding operation is not supported for the class' instances if there is no __add__for exampleexpressions raise exceptions new-style classes have some defaultsbut not for common operations in python xand so-called "new styleclasses in that we'll define latera root classes can intercept python operators