Kaydet (Commit) 98bfbc39 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Backport 1.61 (note, the actual deprecation is not backported since it

could affect existing code; instead, the documentation of the deprecation
is being backported to provide maximum advance notice):

Patch 543387.  Document deprecation of complex %, //,and divmod().
üst 490561e9
...@@ -705,7 +705,7 @@ The integer division and modulo operators are connected by the ...@@ -705,7 +705,7 @@ The integer division and modulo operators are connected by the
following identity: \code{x == (x/y)*y + (x\%y)}. Integer division and following identity: \code{x == (x/y)*y + (x\%y)}. Integer division and
modulo are also connected with the built-in function \function{divmod()}: modulo are also connected with the built-in function \function{divmod()}:
\code{divmod(x, y) == (x/y, x\%y)}. These identities don't hold for \code{divmod(x, y) == (x/y, x\%y)}. These identities don't hold for
floating point and complex numbers; there similar identities hold floating point numbers; there similar identities hold
approximately where \code{x/y} is replaced by \code{floor(x/y)}) or approximately where \code{x/y} is replaced by \code{floor(x/y)}) or
\code{floor(x/y) - 1} (for floats),\footnote{ \code{floor(x/y) - 1} (for floats),\footnote{
If x is very close to an exact integer multiple of y, it's If x is very close to an exact integer multiple of y, it's
...@@ -713,8 +713,13 @@ approximately where \code{x/y} is replaced by \code{floor(x/y)}) or ...@@ -713,8 +713,13 @@ approximately where \code{x/y} is replaced by \code{floor(x/y)}) or
\code{(x-x\%y)/y} due to rounding. In such cases, Python returns \code{(x-x\%y)/y} due to rounding. In such cases, Python returns
the latter result, in order to preserve that \code{divmod(x,y)[0] the latter result, in order to preserve that \code{divmod(x,y)[0]
* y + x \%{} y} be very close to \code{x}. * y + x \%{} y} be very close to \code{x}.
} or \code{floor((x/y).real)} (for }.
complex).
Complex floor division operator, modulo operator, and
\function{divmod()}.
\deprecated{2.3}{Instead convert to float using \function{abs()}
if appropriate.}
The \code{+} (addition) operator yields the sum of its arguments. The \code{+} (addition) operator yields the sum of its arguments.
The arguments must either both be numbers or both sequences of the The arguments must either both be numbers or both sequences of the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment