non-reflected method. This behavior allows subclasses to override their ancestors’ operations. These methods are called to implement the augmented arithmetic assignments ($_{+=}$ ,$_{-=}$ ,$_{*=}$ ,$_{@=}$,$_{/=}$ ,$_{//=}$ ,$_{%=}$ , **= ,$_{<<=}$ ,$_{>>=}$ ,$_{&=}$ ,$_{^=}$,$_{|}$$_{=}$). These methods should attempt to do the operation in-place (modifying self ) and return the result (which could be, but does not have to be, self ). If a specific method is not defined, the augmented assignment falls back to the normal methods. For instance, if x is an instance of a class with an __iadd__() method,$_{x += y}$ is equivalent to$_{x = x.__iadd__(y)}$ . Otherwise,$_{x.__add__(y)}$ and y.__radd__(x) are considered, as with the evaluation of x + y . In certain situations, augmented assignment can result in unexpected errors (see faq-augmented-assignment-tuple-error), but this behavior is in fact part of the data model. Note: Due to a bug in the dispatching mechanism for$_{**=}$ , a class that defines$_{__ipow__()}$ but returns $_{NotImplemented}$would fail to fall back to$_{x.__pow__(y)}$ and$_{y.__rpow__(x)}$ . This bug is fixed in Python 3.10. Called to implement the unary arithmetic operations ($_{-}$ ,$_{+}$ ,$_{abs()}$ and$_{~}$). Called to implement the built-in functions$_{complex()}$ ,$_{int()}$ and$_{float()}$ . Should return a value of the appropriate type. Called to implement$_{operator.index()}$ , and whenever Python needs to losslessly convert the numeric object to an integer object (such as in slicing, or in the built-in$_{bin()}$ ,$_{hex()}$ and$_{oct()}$ functions). Presence of this method indicates that the numeric object is an integer type. Must return an integer. If$_{__int__()}$ ,$_{__float__()}$ and$_{__complex__()}$ are not defined then corresponding built-in func- tions$_{int()}$ ,$_{float()}$ and$_{complex()}$ fall back to$_{__index__()}$ . Called to implement the built-in function$_{round()}$ and$_{math}$ functions$_{trunc()}$ ,$_{floor()}$ and$_{ceil()}$ . Unless ndigits is passed to$_{__round__()}$ all these methods should return the value of the object truncated to an$_{Integral}$(typically an$_{int}$). If$_{__int__()}$ is not defined then the built-in function$_{int()}$ falls back to$_{__trunc__()}$ . Chapter 3. Data model 40 object. __round__ ( self [, ndigits ] ) object. __trunc__ ( self$_{)}$ object. __floor__ ( self$_{)}$ object. __ceil__ ( self$_{)}$ object. __index__ ( self$_{)}$ object. __complex__ ( self$_{)}$ object. __int__ ( self$_{)}$ object. __float__ ( self$_{)}$ object. __neg__ ( self$_{)}$ object. __pos__ ( self$_{)}$ object. __abs__ ( self$_{)}$ object. __invert__ ( self$_{)}$ object. __iadd__ ( self , other$_{)}$ object. __isub__ ( self , other ) object. __imul__ ( self , other$_{)}$ object. __imatmul__ ( self , other$_{)}$ object. __itruediv__ ( self , other ) object. __ifloordiv__ ( self , other ) object. __imod__ ( self , other ) object. __ipow__ ( self , other [, modulo ] ) object. __ilshift__ ( self , other$_{)}$ object. __irshift__ ( self , other$_{)}$ object. __iand__ ( self , other$_{)}$ object. __ixor__ ( self , other$_{)}$ object. __ior__ ( self , other$_{)}$ The Python Language Reference, Release 3.9.5