manyand not for most commonly used operations operators allow classes to integrate with python' object model by overloading type operationsthe user-defined objects we implement with classes can act just like built-insand so provide consistency as well as compatibility with expected interfaces operator overloading is an optional featureit' used primarily by people developing tools for other python programmersnot by application developers andcandidlyyou probably shouldn' use it just because it seems clever or "cool unless class needs to mimic built-in type interfacesit should usually stick to simpler named methods why would an employee database application support expressions like and +for examplenamed methods like giveraise and promote would usually make more sense because of thiswe won' go into details on every operator overloading method available in python in this book stillthere is one operator overloading method you are likely to see in almost every realistic python classthe __init__ methodwhich is known as the constructor method and is used to initialize objectsstate you should pay special attention to this methodbecause __init__along with the self argumentturns out to be key requirement to reading and understanding most oop code in python third example on to another example this timewe'll define subclass of the prior section' second class that implements three specially named attributes that python will call automatically__init__ is run when new instance object is createdself is the new thirdclass object __add__ is run when thirdclass instance appears in expression __str__ is run when an object is printed (technicallywhen it' converted to its print string by the str built-in function or its python internals equivalentour new subclass also defines normally named method called mulwhich changes the instance object in place here' the new subclassclass thirdclass(secondclass)def __init__(selfvalue)self data value def __add__(selfother)return thirdclass(self data otherdef __str__(self)return '[thirdclass% ]self data inherit from secondclass on "thirdclass(value)on "self otheron "print(self)""str() not to be confused with the __init__ py files in module packagesthe method here is class constructor function used to initialize the newly created instancenot module package see for more details class coding basics