diff options
author | Guido van Rossum <guido@python.org> | 2000-12-12 22:03:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-12-12 22:03:47 (GMT) |
commit | ff63f2023d08add363ab595e90e0a07dca8cf6d8 (patch) | |
tree | f3b15366b69a2defaeb84e38e6cae47a68603828 | |
parent | b822c6138ec1e9c9f76e0320f03df54e4fef2e64 (diff) | |
download | cpython-ff63f2023d08add363ab595e90e0a07dca8cf6d8.zip cpython-ff63f2023d08add363ab595e90e0a07dca8cf6d8.tar.gz cpython-ff63f2023d08add363ab595e90e0a07dca8cf6d8.tar.bz2 |
"Documentation" for {}.popitem().
-rw-r--r-- | Doc/lib/libstdtypes.tex | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex index 91dd675..da7ef0d 100644 --- a/Doc/lib/libstdtypes.tex +++ b/Doc/lib/libstdtypes.tex @@ -817,6 +817,9 @@ arbitrary objects): {\code{\var{a}[\var{k}]} if \code{\var{a}.has_key(\var{k})}, else \var{x} (also setting it)} {(5)} + \lineiii{\var{a}.popitem()} + {remove and return an arbitrary (\var{key}, \var{value}) pair} + {(6)} \end{tableiii} \noindent @@ -841,6 +844,9 @@ provided and \var{k} is not in the map, \code{None} is returned. \item[(5)] \function{setdefault()} is like \function{get()}, except that if \var{k} is missing, \var{x} is both returned and inserted into the dictionary as the value of \var{k}. + +\item[(6)] \function{popitem()} is useful to destructively iterate +over a dictionary, as often used in set algorithms. \end{description} |