diff options
author | Fred Drake <fdrake@acm.org> | 2000-02-17 17:45:52 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-02-17 17:45:52 (GMT) |
commit | 1e862e8a37983800f7231a96c66b9b0479ca52bd (patch) | |
tree | 810349f894425d2cb329b35258b653a2f525a6fb /Doc | |
parent | ef0b5dd080ac9880d02beace16b9fba8ab7fde5c (diff) | |
download | cpython-1e862e8a37983800f7231a96c66b9b0479ca52bd.zip cpython-1e862e8a37983800f7231a96c66b9b0479ca52bd.tar.gz cpython-1e862e8a37983800f7231a96c66b9b0479ca52bd.tar.bz2 |
Update the description of int() to include the radix parameter;
omission noted on c.l.py by Aahz Maruch.
Swapped the order of the descriptions of int() and intern() so that
int() comes first (the functions are in alphabetic order).
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libfuncs.tex | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index ae4af6c..b9c03b7 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -312,6 +312,22 @@ module from which it is called). Equivalent to \code{eval(raw_input(\var{prompt}))}. \end{funcdesc} +\begin{funcdesc}{int}{x\optional{, radix}} + Convert a string or number to a plain integer. If the argument is a + string, it must contain a possibly signed decimal number + 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, + \exception{TypeError} is raised. + Otherwise, the argument may be a plain or + long integer or a floating point number. Conversion of floating + point numbers to integers is defined by the C semantics; normally + the conversion truncates towards zero.\footnote{This is ugly --- the + language definition should require truncation towards zero.} +\end{funcdesc} + \begin{funcdesc}{intern}{string} Enter \var{string} in the table of ``interned'' strings and return the interned string -- which is \var{string} itself or a copy. @@ -325,18 +341,6 @@ module from which it is called). garbage collected). \end{funcdesc} -\begin{funcdesc}{int}{x} - Convert a string or number to a plain integer. If the argument is a - string, it must contain a possibly signed decimal number - representable as a Python integer, possibly embedded in whitespace; - this behaves identical to \code{string.atoi(\var{x})}. - Otherwise, the argument may be a plain or - long integer or a floating point number. Conversion of floating - point numbers to integers is defined by the C semantics; normally - the conversion truncates towards zero.\footnote{This is ugly --- the - language definition should require truncation towards zero.} -\end{funcdesc} - \begin{funcdesc}{isinstance}{object, class} Return true if the \var{object} argument is an instance of the \var{class} argument, or of a (direct or indirect) subclass thereof. |