Mercurial > cpython-lru_cache-weakref
diff Doc/lib/libstdtypes.tex @ 15522:aaa54752e4ba legacy-trunk
"Documentation" for {}.popitem().
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 12 Dec 2000 22:03:47 +0000 |
| parents | aaa91ed3fcfd |
| children | a06415994cb5 |
line wrap: on
line diff
--- a/Doc/lib/libstdtypes.tex Tue Dec 12 22:02:59 2000 +0000 +++ b/Doc/lib/libstdtypes.tex Tue Dec 12 22:03:47 2000 +0000 @@ -817,6 +817,9 @@ {\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 @@ \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}
