statement can create the __next__ method automatically the __str__ and __repr__ methods implement object print displays the former is called by the print and str built-in functionsthe latter is called by print and str if there is no __str__and always by the repr built-ininteractive echoesand nested appearances that is__repr__ is used everywhereexcept by print and str when __str__ is defined __str__ is usually used for user-friendly displays__repr__ gives extra details or the object' as-code form slicing is caught by the __getitem__ indexing methodit is called with slice objectinstead of simple integer indexand slice objects may be passed on or inspected as needed in python x__getslice__ (defunct in xmay be used for two-limit slices as well in-place addition tries __iadd__ firstand __add__ with an assignment second the same pattern holds true for all binary operators the __radd__ method is also available for right-side addition when class naturally matchesor needs to emulatea built-in type' interfaces for examplecollections might imitate sequence or mapping interfacesand callables might be coded for use with an api that expects function you generally shouldn' implement expression operators if they don' naturally map to your objects naturally and logicallythough--use normally named methods instead operator overloading