and documented in full in the standard language manual and other reference resources for examplethe name __add__ always maps to expressions by python language definitionregardless of what an __add__ method' code actually does operator overloading methods may be inherited from superclasses if not definedjust like any other methods operator overloading methods are also all optional--if you don' code or inherit onethat operation is simply unsupported by your classand attempting it will raise an exception some built-in operationslike printinghave defaults (inherited from the implied object class in python )but most built-ins fail for class instances if no corresponding operator overloading method is present most overloading methods are used only in advanced programs that require objects to behave like built-insthough the __init__ constructor we've already met tends to appear in most classes let' explore some of the additional methods in table - by example although expressions trigger operator methodsbe careful not to assume that there is speed advantage to cutting out the middleman and calling the operator method directly in factcalling the operator method directly might be twice as slowpresumably because of the overhead of function callwhich python avoids or optimizes in built-in cases here' the story for len and __len__ using appendix ' windows launcher and ' timing techniques on python and in bothcalling __len__ directly takes twice as longc:\codepy - - timeit - - - " list(range( ))" __len__() loopsbest of usec per loop :\codepy - - timeit - - - " list(range( ))" len( ) loopsbest of usec per loop :\codepy - - timeit - - - " list(range( ))" __len__() loopsbest of usec per loop :\codepy - - timeit - - - " list(range( ))" len( ) loopsbest of usec per loop this is not as artificial as it may seem-- 've actually come across recommendations for using the slower alternative in the name of speed at noted research institutionindexing and slicing__getitem__ and __setitem__ our first method set allows your classes to mimic some of the behaviors of sequences and mappings if defined in class (or inherited by it)the __getitem__ method is called operator overloading