summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-01-14 18:44:23 (GMT)
committerGuido van Rossum <guido@python.org>1997-01-14 18:44:23 (GMT)
commit5cd752028c8d4263d4ecfd17378198a7ea1be26a (patch)
tree0780e4eea415b52329b35f30888a06457649f453
parent9a0313cd624e79368d3b6744f0362b6f53469a1f (diff)
downloadcpython-5cd752028c8d4263d4ecfd17378198a7ea1be26a.zip
cpython-5cd752028c8d4263d4ecfd17378198a7ea1be26a.tar.gz
cpython-5cd752028c8d4263d4ecfd17378198a7ea1be26a.tar.bz2
Describe new ("unsigned") behavior of hex() and oct().
-rw-r--r--Doc/lib/libfuncs.tex14
-rw-r--r--Doc/libfuncs.tex14
2 files changed, 24 insertions, 4 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex
index 9e7d4c1..ddb3a91 100644
--- a/Doc/lib/libfuncs.tex
+++ b/Doc/lib/libfuncs.tex
@@ -189,7 +189,12 @@ module from which it is called).
\begin{funcdesc}{hex}{x}
Convert an integer number (of any size) to a hexadecimal string.
- The result is a valid Python expression.
+ The result is a valid Python expression. Note: this always yields
+ an unsigned literal, e.g. on a 32-bit machine, \code{hex(-1)} yields
+ \code{'0xffffffff'}. When evaluated on a machine with the same
+ word size, this literal is evaluated as -1; at a different word
+ size, it may turn up as a large positive number or raise an
+ \code{OverflowError} exception.
\end{funcdesc}
\begin{funcdesc}{id}{object}
@@ -256,7 +261,12 @@ any kind of sequence; the result is always a list.
\begin{funcdesc}{oct}{x}
Convert an integer number (of any size) to an octal string. The
- result is a valid Python expression.
+ result is a valid Python expression. Note: this always yields
+ an unsigned literal, e.g. on a 32-bit machine, \code{oct(-1)} yields
+ \code{'037777777777'}. When evaluated on a machine with the same
+ word size, this literal is evaluated as -1; at a different word
+ size, it may turn up as a large positive number or raise an
+ \code{OverflowError} exception.
\end{funcdesc}
\begin{funcdesc}{open}{filename\optional{\, mode\optional{\, bufsize}}}
diff --git a/Doc/libfuncs.tex b/Doc/libfuncs.tex
index 9e7d4c1..ddb3a91 100644
--- a/Doc/libfuncs.tex
+++ b/Doc/libfuncs.tex
@@ -189,7 +189,12 @@ module from which it is called).
\begin{funcdesc}{hex}{x}
Convert an integer number (of any size) to a hexadecimal string.
- The result is a valid Python expression.
+ The result is a valid Python expression. Note: this always yields
+ an unsigned literal, e.g. on a 32-bit machine, \code{hex(-1)} yields
+ \code{'0xffffffff'}. When evaluated on a machine with the same
+ word size, this literal is evaluated as -1; at a different word
+ size, it may turn up as a large positive number or raise an
+ \code{OverflowError} exception.
\end{funcdesc}
\begin{funcdesc}{id}{object}
@@ -256,7 +261,12 @@ any kind of sequence; the result is always a list.
\begin{funcdesc}{oct}{x}
Convert an integer number (of any size) to an octal string. The
- result is a valid Python expression.
+ result is a valid Python expression. Note: this always yields
+ an unsigned literal, e.g. on a 32-bit machine, \code{oct(-1)} yields
+ \code{'037777777777'}. When evaluated on a machine with the same
+ word size, this literal is evaluated as -1; at a different word
+ size, it may turn up as a large positive number or raise an
+ \code{OverflowError} exception.
\end{funcdesc}
\begin{funcdesc}{open}{filename\optional{\, mode\optional{\, bufsize}}}