diff options
author | Guido van Rossum <guido@python.org> | 1998-06-30 15:56:23 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-06-30 15:56:23 (GMT) |
commit | 97ea11647261d9c1f1280a146c301e13b6391d5e (patch) | |
tree | 6805d2ac52492f20f3b4b16cb7a054b0bc51ca63 | |
parent | 9c59ce9b5a7d9470a4faf2644d59ae5cad2d1582 (diff) | |
download | cpython-97ea11647261d9c1f1280a146c301e13b6391d5e.zip cpython-97ea11647261d9c1f1280a146c301e13b6391d5e.tar.gz cpython-97ea11647261d9c1f1280a146c301e13b6391d5e.tar.bz2 |
Documented the pop() method for lists.
# The brackets generated by \optional{} are real ugly. Alas...
-rw-r--r-- | Doc/lib/libtypes.tex | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Doc/lib/libtypes.tex b/Doc/lib/libtypes.tex index c16c1fc..0dd1fef 100644 --- a/Doc/lib/libtypes.tex +++ b/Doc/lib/libtypes.tex @@ -460,17 +460,19 @@ The following operations are defined on mutable sequence types (where \lineiii{\var{s}.append(\var{x})} {same as \code{\var{s}[len(\var{s}):len(\var{s})] = [\var{x}]}}{} \lineiii{\var{s}.count(\var{x})} - {return number of \var{i}'s for which \code{\var{s}[\var{i}] == \var{x}}}{} + {return number of \var{i}'s for which \code{\var{s}[\var{i}] == \var{x}}}{} \lineiii{\var{s}.index(\var{x})} - {return smallest \var{i} such that \code{\var{s}[\var{i}] == \var{x}}}{(1)} + {return smallest \var{i} such that \code{\var{s}[\var{i}] == \var{x}}}{(1)} \lineiii{\var{s}.insert(\var{i}, \var{x})} {same as \code{\var{s}[\var{i}:\var{i}] = [\var{x}]} if \code{\var{i} >= 0}}{} + \lineiii{\var{s}.pop(\optional{\var{i}})} + {same as \code{x = \var{s}[\var{i}]; del \var{s}[\var{i}]; return x}}{(4)} \lineiii{\var{s}.remove(\var{x})} {same as \code{del \var{s}[\var{s}.index(\var{x})]}}{(1)} \lineiii{\var{s}.reverse()} {reverses the items of \var{s} in place}{(3)} - \lineiii{\var{s}.sort()} + \lineiii{\var{s}.sort(\var{cmpfunc})} {sort the items of \var{s} in place}{(2), (3)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} @@ -508,6 +510,9 @@ list in place for economy of space when sorting or reversing a large list. They don't return the sorted or reversed list to remind you of this side effect. +\item[(4)4] The optional argument \var{i} defaults to \code{-1}, so that +by default the last item is removed and returned. + \end{description} @@ -849,7 +854,7 @@ object's (writable) attributes; \item \code{\var{x}.__methods__} lists the methods of many built-in object types, e.g., \code{[].__methods__} yields -\code{['append', 'count', 'index', 'insert', 'remove', 'reverse', 'sort']}; +\code{['append', 'count', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']}; \item \code{\var{x}.__members__} lists data attributes; |