diff options
author | Raymond Hettinger <python@rcn.com> | 2003-03-06 23:54:28 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-03-06 23:54:28 (GMT) |
commit | a3e1e4cd79abe7069c8bc20db65161dd8c68b305 (patch) | |
tree | 18ff4fb0f06cc1a684da8ad62ce21a5b14c1a33c /Doc/lib | |
parent | 2b4821347f00b01746562d58390a213924f2b102 (diff) | |
download | cpython-a3e1e4cd79abe7069c8bc20db65161dd8c68b305.zip cpython-a3e1e4cd79abe7069c8bc20db65161dd8c68b305.tar.gz cpython-a3e1e4cd79abe7069c8bc20db65161dd8c68b305.tar.bz2 |
SF patch #693753: fix for bug 639806: default for dict.pop
(contributed by Michael Stone.)
Diffstat (limited to 'Doc/lib')
-rw-r--r-- | Doc/lib/libstdtypes.tex | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex index 0006c76..1a7b505 100644 --- a/Doc/lib/libstdtypes.tex +++ b/Doc/lib/libstdtypes.tex @@ -1104,9 +1104,10 @@ arbitrary objects): {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}, else \var{x} (also setting it)} {(5)} - \lineiii{\var{a}.pop(\var{k})} - {remove specified \var{key} and return corresponding \var{value}} - {} + \lineiii{\var{a}.pop(\var{k}\optional{, \var{x}})} + {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}, + else \var{x} (and remove k)} + {(8)} \lineiii{\var{a}.popitem()} {remove and return an arbitrary (\var{key}, \var{value}) pair} {(6)} @@ -1155,6 +1156,9 @@ over a dictionary, as often used in set algorithms. \item[(7)] \function{fromkeys()} is a class method that returns a new dictionary. \var{value} defaults to \code{None}. \versionadded{2.3} + +\item[(8)] \function{pop()} raises a \exception{KeyError} when no default +value is given and the key is not found. \versionadded{2.3} \end{description} |