Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b0b23cb5
Commit
b0b23cb5
authored
May 21, 2002
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch 543387. Document deprecation of complex %, //,and divmod().
parent
b4444e80
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
10 deletions
+21
-10
Doc/lib/libfuncs.tex
Doc/lib/libfuncs.tex
+3
-3
Doc/lib/libstdtypes.tex
Doc/lib/libstdtypes.tex
+10
-4
Doc/ref/ref5.tex
Doc/ref/ref5.tex
+8
-3
No files found.
Doc/lib/libfuncs.tex
View file @
b0b23cb5
...
@@ -248,9 +248,9 @@ def my_import(name):
...
@@ -248,9 +248,9 @@ def my_import(name):
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
divmod
}{
a, b
}
\begin{funcdesc}
{
divmod
}{
a, b
}
Take two
numbers as arguments and return a pair of numbers consisting
Take two
(non complex) numbers as arguments and return a pair of numbers
of their quotient and remainder when using long division. With mixed
consisting of their quotient and remainder when using long division. With
operand types, the rules for binary arithmetic operators apply. For
mixed
operand types, the rules for binary arithmetic operators apply. For
plain and long integers, the result is the same as
plain and long integers, the result is the same as
\code
{
(
\var
{
a
}
/
\var
{
b
}
,
\var
{
a
}
\%
{}
\var
{
b
}
)
}
.
\code
{
(
\var
{
a
}
/
\var
{
b
}
,
\var
{
a
}
\%
{}
\var
{
b
}
)
}
.
For floating point numbers the result is
\code
{
(
\var
{
q
}
,
\var
{
a
}
\%
{}
For floating point numbers the result is
\code
{
(
\var
{
q
}
,
\var
{
a
}
\%
{}
...
...
Doc/lib/libstdtypes.tex
View file @
b0b23cb5
...
@@ -218,8 +218,8 @@ to coerce numbers to a specific type.
...
@@ -218,8 +218,8 @@ to coerce numbers to a specific type.
\bifuncindex
{
float
}
\bifuncindex
{
float
}
\bifuncindex
{
complex
}
\bifuncindex
{
complex
}
All numeric types
support the following operations, sorted by
All numeric types
(except complex) support the following operations,
ascending priority (operations in the same box have the same
sorted by
ascending priority (operations in the same box have the same
priority; all numeric operations have a higher priority than
priority; all numeric operations have a higher priority than
comparison operations):
comparison operations):
...
@@ -229,7 +229,7 @@ comparison operations):
...
@@ -229,7 +229,7 @@ comparison operations):
\hline
\hline
\lineiii
{
\var
{
x
}
*
\var
{
y
}}{
product of
\var
{
x
}
and
\var
{
y
}}{}
\lineiii
{
\var
{
x
}
*
\var
{
y
}}{
product of
\var
{
x
}
and
\var
{
y
}}{}
\lineiii
{
\var
{
x
}
/
\var
{
y
}}{
quotient of
\var
{
x
}
and
\var
{
y
}}{
(1)
}
\lineiii
{
\var
{
x
}
/
\var
{
y
}}{
quotient of
\var
{
x
}
and
\var
{
y
}}{
(1)
}
\lineiii
{
\var
{
x
}
\%
{}
\var
{
y
}}{
remainder of
\code
{
\var
{
x
}
/
\var
{
y
}}}{}
\lineiii
{
\var
{
x
}
\%
{}
\var
{
y
}}{
remainder of
\code
{
\var
{
x
}
/
\var
{
y
}}}{
(4)
}
\hline
\hline
\lineiii
{
-
\var
{
x
}}{
\var
{
x
}
negated
}{}
\lineiii
{
-
\var
{
x
}}{
\var
{
x
}
negated
}{}
\lineiii
{
+
\var
{
x
}}{
\var
{
x
}
unchanged
}{}
\lineiii
{
+
\var
{
x
}}{
\var
{
x
}
unchanged
}{}
...
@@ -240,7 +240,7 @@ comparison operations):
...
@@ -240,7 +240,7 @@ comparison operations):
\lineiii
{
float(
\var
{
x
}
)
}{
\var
{
x
}
converted to floating point
}{}
\lineiii
{
float(
\var
{
x
}
)
}{
\var
{
x
}
converted to floating point
}{}
\lineiii
{
complex(
\var
{
re
}
,
\var
{
im
}
)
}{
a complex number with real part
\var
{
re
}
, imaginary part
\var
{
im
}
.
\var
{
im
}
defaults to zero.
}{}
\lineiii
{
complex(
\var
{
re
}
,
\var
{
im
}
)
}{
a complex number with real part
\var
{
re
}
, imaginary part
\var
{
im
}
.
\var
{
im
}
defaults to zero.
}{}
\lineiii
{
\var
{
c
}
.conjugate()
}{
conjugate of the complex number
\var
{
c
}}{}
\lineiii
{
\var
{
c
}
.conjugate()
}{
conjugate of the complex number
\var
{
c
}}{}
\lineiii
{
divmod(
\var
{
x
}
,
\var
{
y
}
)
}{
the pair
\code
{
(
\var
{
x
}
/
\var
{
y
}
,
\var
{
x
}
\%
{}
\var
{
y
}
)
}}{
(3)
}
\lineiii
{
divmod(
\var
{
x
}
,
\var
{
y
}
)
}{
the pair
\code
{
(
\var
{
x
}
/
\var
{
y
}
,
\var
{
x
}
\%
{}
\var
{
y
}
)
}}{
(3)
(4)
}
\lineiii
{
pow(
\var
{
x
}
,
\var
{
y
}
)
}{
\var
{
x
}
to the power
\var
{
y
}}{}
\lineiii
{
pow(
\var
{
x
}
,
\var
{
y
}
)
}{
\var
{
x
}
to the power
\var
{
y
}}{}
\lineiii
{
\var
{
x
}
**
\var
{
y
}}{
\var
{
x
}
to the power
\var
{
y
}}{}
\lineiii
{
\var
{
x
}
**
\var
{
y
}}{
\var
{
x
}
to the power
\var
{
y
}}{}
\end{tableiii}
\end{tableiii}
...
@@ -273,6 +273,12 @@ for well-defined conversions.
...
@@ -273,6 +273,12 @@ for well-defined conversions.
See section
\ref
{
built-in-funcs
}
, ``Built-in Functions,'' for a full
See section
\ref
{
built-in-funcs
}
, ``Built-in Functions,'' for a full
description.
description.
\item
[(4)]
Complex floor division operator, modulo operator, and
\function
{
divmod()
}
.
\deprecated
{
2.3
}{
Instead convert to float using
\function
{
abs()
}
if appropriate.
}
\end{description}
\end{description}
% XXXJH exceptions: overflow (when? what operations?) zerodivision
% XXXJH exceptions: overflow (when? what operations?) zerodivision
...
...
Doc/ref/ref5.tex
View file @
b0b23cb5
...
@@ -689,7 +689,7 @@ The integer division and modulo operators are connected by the
...
@@ -689,7 +689,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
...
@@ -697,8 +697,13 @@ approximately where \code{x/y} is replaced by \code{floor(x/y)}) or
...
@@ -697,8 +697,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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment