summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libfuncs.tex
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-11-17 19:44:14 (GMT)
committerFred Drake <fdrake@acm.org>2000-11-17 19:44:14 (GMT)
commit17383b9ad77071b2a15cf3286353281e04e139d2 (patch)
tree8176cc8ee9dd9d933643a8a6c0a1a9ed9178951c /Doc/lib/libfuncs.tex
parent977fe96a055ab9867d1e61ff5ad7799e55fdfbd2 (diff)
downloadcpython-17383b9ad77071b2a15cf3286353281e04e139d2.zip
cpython-17383b9ad77071b2a15cf3286353281e04e139d2.tar.gz
cpython-17383b9ad77071b2a15cf3286353281e04e139d2.tar.bz2
Added information about the %r string formatting conversion. Added note
about the interpretation of radix 0 for int(), and added description of the optional radix argument for long(). Based on comments from Reuben Sumner <rasumner@users.sourceforge.net>. This closes bug #121672.
Diffstat (limited to 'Doc/lib/libfuncs.tex')
-rw-r--r--Doc/lib/libfuncs.tex12
1 files changed, 8 insertions, 4 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex
index cb5acde..7ffc2ea 100644
--- a/Doc/lib/libfuncs.tex
+++ b/Doc/lib/libfuncs.tex
@@ -331,8 +331,10 @@ module from which it is called).
representable as a Python integer, possibly embedded in whitespace;
this behaves identical to \code{string.atoi(\var{x}\optional{,
\var{radix}})}. The \var{radix} parameter gives the base for the
- conversion and may be any integer in the range [2, 36]. If
- \var{radix} is specified and \var{x} is not a string,
+ conversion and may be any integer in the range [2, 36], or zero. If
+ \var{radix} is zero, the proper radix is guessed based on the
+ contents of string; the interpretation is the same as for integer
+ literals. If \var{radix} is specified and \var{x} is not a string,
\exception{TypeError} is raised.
Otherwise, the argument may be a plain or
long integer or a floating point number. Conversion of floating
@@ -392,11 +394,13 @@ modified; changes may not affect the values of local variables used by
the interpreter.
\end{funcdesc}
-\begin{funcdesc}{long}{x}
+\begin{funcdesc}{long}{x\optional{, radix}}
Convert a string or number to a long integer. If the argument is a
string, it must contain a possibly signed decimal number of
arbitrary size, possibly embedded in whitespace;
- this behaves identical to \code{string.atol(\var{x})}.
+ this behaves identical to \code{string.atol(\var{x})}. The
+ \var{radix} argument is interpreted in the same way as for
+ \function{int()}, and may only be given when \var{x} is a string.
Otherwise, the argument may be a plain or
long integer or a floating point number, and a long integer with
the same value is returned. Conversion of floating