diff options
author | Peter Schneider-Kamp <nowonder@nowonder.de> | 2000-07-31 20:52:21 (GMT) |
---|---|---|
committer | Peter Schneider-Kamp <nowonder@nowonder.de> | 2000-07-31 20:52:21 (GMT) |
commit | 5a65c2d43607a5033d7171445848cde21f07d81d (patch) | |
tree | d8dad896da0f678879cdf5b62ad38e01ccb85430 /Doc/lib | |
parent | 4640e13259d50b754c1e0ea39b05559b3cd18cc3 (diff) | |
download | cpython-5a65c2d43607a5033d7171445848cde21f07d81d.zip cpython-5a65c2d43607a5033d7171445848cde21f07d81d.tar.gz cpython-5a65c2d43607a5033d7171445848cde21f07d81d.tar.bz2 |
added count, extend, index, pop and remove to arraymodule
Diffstat (limited to 'Doc/lib')
-rw-r--r-- | Doc/lib/libarray.tex | 23 | ||||
-rw-r--r-- | Doc/lib/libstdtypes.tex | 4 |
2 files changed, 25 insertions, 2 deletions
diff --git a/Doc/lib/libarray.tex b/Doc/lib/libarray.tex index 0e1a411..7be96aa 100644 --- a/Doc/lib/libarray.tex +++ b/Doc/lib/libarray.tex @@ -83,6 +83,14 @@ values, \exception{RuntimeError} is raised. It is useful when reading data from a file written on a machine with a different byte order. \end{methoddesc} +\begin{methoddesc}[array]{count}{x} +Return the number of occurences of \var{x} in the array. +\end{methoddesc} + +\begin{methoddesc}[array]{extend}{a} +Append array items from \var{a} to the end of the array. +\end{methoddesc} + \begin{methoddesc}[array]{fromfile}{f, n} Read \var{n} items (as machine values) from the file object \var{f} and append them to the end of the array. If less than \var{n} items @@ -104,11 +112,22 @@ array of machine values (i.e. as if it had been read from a file using the \method{fromfile()} method). \end{methoddesc} +\begin{methoddesc}[array]{index}{x} +Return the smallest \var{i} such that \var{i} is the index of +the first occurence of \var{x} in the array. +\end{methoddesc} + \begin{methoddesc}[array]{insert}{i, x} Insert a new item with value \var{x} in the array before position \var{i}. \end{methoddesc} +\begin{methoddesc}[array]{pop}{\optional{i}} +Removes the item with the index \var{i} from the array and returns +it. The optional argument defaults to \code{-1}, so that by default +the last item is removed and returned. +\end{methoddesc} + \begin{methoddesc}[array]{read}{f, n} \deprecated {1.5.1} {Use the \method{fromfile()} method.} @@ -120,6 +139,10 @@ built-in file object; something else with a \method{read()} method won't do. \end{methoddesc} +\begin{methoddesc}[array]{remove}{x} +Remove the first occurence of \var{x} from the array. +\end{methoddesc} + \begin{methoddesc}[array]{reverse}{} Reverse the order of the items in the array. \end{methoddesc} diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex index 2dca492..4f8020e 100644 --- a/Doc/lib/libstdtypes.tex +++ b/Doc/lib/libstdtypes.tex @@ -506,8 +506,8 @@ Notes: \item[(3)] Raises \exception{ValueError} when \var{x} is not found in \var{s}. -\item[(4)] The \method{pop()} method is experimental and not supported - by other mutable sequence types than lists. The optional argument +\item[(4)] The \method{pop()} method is experimental and at the moment + only supported by the list and array types. The optional argument \var{i} defaults to \code{-1}, so that by default the last item is removed and returned. |