[Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.134,1.135
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Wed, 11 Jun 2003 01:16:12 -0700
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv19944
Modified Files:
libfuncs.tex
Log Message:
SF bug #660022: parameters for int(), str(), etc.
* Indicate that arguments are optional for most builtin type constructors.
* Replace e.g. in staticmethod() and classmethod() docs.
* Add \code{} markup to some in-line code examples.
Index: libfuncs.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v
retrieving revision 1.134
retrieving revision 1.135
diff -C2 -d -r1.134 -r1.135
*** libfuncs.tex 10 Jun 2003 21:41:22 -0000 1.134
--- libfuncs.tex 11 Jun 2003 08:16:06 -0000 1.135
***************
*** 81,85 ****
\end{funcdesc}
! \begin{funcdesc}{bool}{x}
Convert a value to a Boolean, using the standard truth testing
procedure. If \code{x} is false, this returns \code{False};
--- 81,85 ----
\end{funcdesc}
! \begin{funcdesc}{bool}{\optional{x}}
Convert a value to a Boolean, using the standard truth testing
procedure. If \code{x} is false, this returns \code{False};
***************
*** 87,91 ****
which is a subclass of \code{int}. Class \code{bool} cannot be
subclassed further. Its only instances are \code{False} and
! \code{True}.
\indexii{Boolean}{type}
\versionadded{2.2.1}
--- 87,92 ----
which is a subclass of \code{int}. Class \code{bool} cannot be
subclassed further. Its only instances are \code{False} and
! \code{True}. If no argument is given, this function returns
! \code{False}.
\indexii{Boolean}{type}
\versionadded{2.2.1}
***************
*** 133,138 ****
\end{verbatim}
! It can be called either on the class (e.g. C.f()) or on an instance
! (e.g. C().f()). The instance is ignored except for its class.
If a class method is called for a derived class, the derived class
object is passed as the implied first argument.
--- 134,140 ----
\end{verbatim}
! It can be called either on the class (such as \code{C.f()}) or on an
! instance (such as \code{C().f()}). The instance is ignored except for
! its class.
If a class method is called for a derived class, the derived class
object is passed as the implied first argument.
***************
*** 196,200 ****
\end{funcdesc}
! \begin{funcdesc}{complex}{real\optional{, imag}}
Create a complex number with the value \var{real} + \var{imag}*j or
convert a string or number to a complex number. If the first
--- 198,202 ----
\end{funcdesc}
! \begin{funcdesc}{complex}{\optional{real\optional{, imag}}}
Create a complex number with the value \var{real} + \var{imag}*j or
convert a string or number to a complex number. If the first
***************
*** 205,209 ****
If \var{imag} is omitted, it defaults to zero and the function
serves as a numeric conversion function like \function{int()},
! \function{long()} and \function{float()}.
\end{funcdesc}
--- 207,212 ----
If \var{imag} is omitted, it defaults to zero and the function
serves as a numeric conversion function like \function{int()},
! \function{long()} and \function{float()}. If both arguments
! are omitted, returns \code{0j}.
\end{funcdesc}
***************
*** 448,452 ****
\end{funcdesc}
! \begin{funcdesc}{float}{x}
Convert a string or a number to floating point. If the argument is a
string, it must contain a possibly signed decimal or floating point
--- 451,455 ----
\end{funcdesc}
! \begin{funcdesc}{float}{\optional{x}}
Convert a string or a number to floating point. If the argument is a
string, it must contain a possibly signed decimal or floating point
***************
*** 455,459 ****
or long integer or a floating point number, and a floating point
number with the same value (within Python's floating point
! precision) is returned.
\note{When passing in a string, values for NaN\index{NaN}
--- 458,462 ----
or long integer or a floating point number, and a floating point
number with the same value (within Python's floating point
! precision) is returned. If no argument is given, returns \code{0.0}.
\note{When passing in a string, values for NaN\index{NaN}
***************
*** 541,545 ****
\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
--- 544,548 ----
\end{funcdesc}
! \begin{funcdesc}{int}{\optional{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
***************
*** 555,559 ****
point numbers to integers truncates (towards zero).
If the argument is outside the integer range a long object will
! be returned instead.
\end{funcdesc}
--- 558,562 ----
point numbers to integers truncates (towards zero).
If the argument is outside the integer range a long object will
! be returned instead. If no arguments are given, returns \code{0}.
\end{funcdesc}
***************
*** 626,630 ****
similar to \code{\var{sequence}[:]}. For instance,
\code{list('abc')} returns \code{['a', 'b', 'c']} and \code{list(
! (1, 2, 3) )} returns \code{[1, 2, 3]}.
\end{funcdesc}
--- 629,634 ----
similar to \code{\var{sequence}[:]}. For instance,
\code{list('abc')} returns \code{['a', 'b', 'c']} and \code{list(
! (1, 2, 3) )} returns \code{[1, 2, 3]}. If no argument is given,
! returns a new empty list, \code{[]}.
\end{funcdesc}
***************
*** 636,640 ****
\end{funcdesc}
! \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 number of
--- 640,644 ----
\end{funcdesc}
! \begin{funcdesc}{long}{\optional{x\optional{, radix}}}
Convert a string or number to a long integer. If the argument is a
string, it must contain a possibly signed number of
***************
*** 646,650 ****
long integer or a floating point number, and a long integer with
the same value is returned. Conversion of floating
! point numbers to integers truncates (towards zero).
\end{funcdesc}
--- 650,655 ----
long integer or a floating point number, and a long integer with
the same value is returned. Conversion of floating
! point numbers to integers truncates (towards zero). If no arguments
! are given, returns \code{0L}.
\end{funcdesc}
***************
*** 897,902 ****
\end{verbatim}
! It can be called either on the class (e.g. C.f()) or on an instance
! (e.g. C().f()). The instance is ignored except for its class.
Static methods in Python are similar to those found in Java or C++.
--- 902,908 ----
\end{verbatim}
! It can be called either on the class (such as \code{C.f()}) or on an
! instance (such as \code{C().f()}). The instance is ignored except
! for its class.
Static methods in Python are similar to those found in Java or C++.
***************
*** 930,934 ****
\end{funcdesc}
! \begin{funcdesc}{str}{object}
Return a string containing a nicely printable representation of an
object. For strings, this returns the string itself. The
--- 936,940 ----
\end{funcdesc}
! \begin{funcdesc}{str}{\optional{object}}
Return a string containing a nicely printable representation of an
object. For strings, this returns the string itself. The
***************
*** 936,940 ****
\code{str(\var{object})} does not always attempt to return a string
that is acceptable to \function{eval()}; its goal is to return a
! printable string.
\end{funcdesc}
--- 942,947 ----
\code{str(\var{object})} does not always attempt to return a string
that is acceptable to \function{eval()}; its goal is to return a
! printable string. If no argument is given, returns the empty
! string, \code{''}.
\end{funcdesc}
***************
*** 946,950 ****
is returned unchanged. For instance, \code{tuple('abc')} returns
returns \code{('a', 'b', 'c')} and \code{tuple([1, 2, 3])} returns
! \code{(1, 2, 3)}.
\end{funcdesc}
--- 953,958 ----
is returned unchanged. For instance, \code{tuple('abc')} returns
returns \code{('a', 'b', 'c')} and \code{tuple([1, 2, 3])} returns
! \code{(1, 2, 3)}. If no argument is given, returns a new empty
! tuple, \code{()}.
\end{funcdesc}
***************
*** 982,986 ****
\end{funcdesc}
! \begin{funcdesc}{unicode}{object\optional{, encoding\optional{, errors}}}
Return the Unicode string version of \var{object} using one of the
following modes:
--- 990,995 ----
\end{funcdesc}
! \begin{funcdesc}{unicode}{\optional{object\optional{, encoding
! \optional{, errors}}}}
Return the Unicode string version of \var{object} using one of the
following modes: