@@ -1330,7 +1330,7 @@ \subsection{Emulating numeric types\label{numeric-types}}
13301330\begin {methoddesc }[numeric object]{__add__}{self, other}
13311331\methodline [numeric object]{__sub__}{self, other}
13321332\methodline [numeric object]{__mul__}{self, other}
1333- \methodline [numeric object]{__div__ }{self, other}
1333+ \methodline [numeric object]{__floordiv__ }{self, other}
13341334\methodline [numeric object]{__mod__}{self, other}
13351335\methodline [numeric object]{__divmod__}{self, other}
13361336\methodline [numeric object]{__pow__}{self, other\optional {, modulo}}
@@ -1339,20 +1339,32 @@ \subsection{Emulating numeric types\label{numeric-types}}
13391339\methodline [numeric object]{__and__}{self, other}
13401340\methodline [numeric object]{__xor__}{self, other}
13411341\methodline [numeric object]{__or__}{self, other}
1342- These functions are
1342+ These methods are
13431343called to implement the binary arithmetic operations (\code {+},
1344- \code {-}, \code {*}, \code {/}, \code {\% },
1344+ \code {-}, \code {*}, \code {// }, \code {\% },
13451345\function {divmod()}\bifuncindex {divmod},
13461346\function {pow()}\bifuncindex {pow}, \code {**}, \code {<}\code {<},
13471347\code {>}\code {>}, \code {\& }, \code {\^ }, \code {|}). For instance, to
13481348evaluate the expression \var {x}\code {+}\var {y}, where \var {x} is an
13491349instance of a class that has an \method {__add__()} method,
1350- \code {\var {x}.__add__(\var {y})} is called. Note that
1350+ \code {\var {x}.__add__(\var {y})} is called. The \method {__divmod__()}
1351+ method should be the equivalent to using \method {__floordiv__()} and
1352+ \method {__mod__()}; it should not be related to \method {__truediv__()}
1353+ (described below). Note that
13511354\method {__pow__()} should be defined to accept an optional third
13521355argument if the ternary version of the built-in
13531356\function {pow()}\bifuncindex {pow} function is to be supported.
13541357\end {methoddesc }
13551358
1359+ \begin {methoddesc }[numeric object]{__div__}{self, other}
1360+ \methodline [numeric object]{__truediv__}{self, other}
1361+ The division operator (\code {/}) is implemented by these methods. The
1362+ \method {__truediv__()} method is used when \code {__future__.division}
1363+ is in effect, otherwise \method {__div__()} is used. If only one of
1364+ these two methods is defined, the object will not support division in
1365+ the alternate context; \exception {TypeError} will be raised instead.
1366+ \end {methoddesc }
1367+
13561368\begin {methoddesc }[numeric object]{__radd__}{self, other}
13571369\methodline [numeric object]{__rsub__}{self, other}
13581370\methodline [numeric object]{__rmul__}{self, other}
@@ -1365,7 +1377,7 @@ \subsection{Emulating numeric types\label{numeric-types}}
13651377\methodline [numeric object]{__rand__}{self, other}
13661378\methodline [numeric object]{__rxor__}{self, other}
13671379\methodline [numeric object]{__ror__}{self, other}
1368- These functions are
1380+ These methods are
13691381called to implement the binary arithmetic operations (\code {+},
13701382\code {-}, \code {*}, \code {/}, \code {\% },
13711383\function {divmod()}\bifuncindex {divmod},
0 commit comments