diff options
author | Fred Drake <fdrake@acm.org> | 2001-08-10 21:31:12 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-08-10 21:31:12 (GMT) |
commit | 11ee90289c9bf5cf1752654688a436c8d2b403ab (patch) | |
tree | 3f140f638be481d739d0e9590270d2f750bb79d6 /Doc/api | |
parent | e45763a8e614dfea111e4a446ab592c5e2a8682c (diff) | |
download | cpython-11ee90289c9bf5cf1752654688a436c8d2b403ab.zip cpython-11ee90289c9bf5cf1752654688a436c8d2b403ab.tar.gz cpython-11ee90289c9bf5cf1752654688a436c8d2b403ab.tar.bz2 |
Added documentation for PyDict_Update() and PyDict_Merge().
Diffstat (limited to 'Doc/api')
-rw-r--r-- | Doc/api/api.tex | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Doc/api/api.tex b/Doc/api/api.tex index 69f0f02..3e0fe34 100644 --- a/Doc/api/api.tex +++ b/Doc/api/api.tex @@ -3782,6 +3782,7 @@ Empties an existing dictionary of all key-value pairs. \begin{cfuncdesc}{PyObject*}{PyDict_Copy}{PyObject *p} Returns a new dictionary that contains the same key-value pairs as p. Empties an existing dictionary of all key-value pairs. +\versionadded{1.6} \end{cfuncdesc} \begin{cfuncdesc}{int}{PyDict_SetItem}{PyObject *p, PyObject *key, @@ -3874,7 +3875,8 @@ while (PyDict_Next(self->dict, &pos, &key, &value)) { The dictionary \var{p} should not be mutated during iteration. It is safe (since Python 2.1) to modify the values of the keys as you -iterate over the dictionary, for example: +iterate over the dictionary, but only so long as the set of keys does +not change. For example: \begin{verbatim} PyObject *key, *value; @@ -3894,6 +3896,22 @@ while (PyDict_Next(self->dict, &pos, &key, &value)) { \end{verbatim} \end{cfuncdesc} +\begin{cfuncdesc}{int}{PyDict_Merge}{PyObject *a, PyObject *b, int override} +Iterate over dictionary \var{b} adding key-value pairs to dictionary +\var{a}. If \var{override} is true, existing pairs in \var{a} will be +replaced if a matching key is found in \var{b}, otherwise pairs will +only be added if there is not a matching key in \var{a}. Returns +\code{0} on success or \code{-1} if an exception was raised. +\versionadded{2.2} +\end{cfuncdesc} + +\begin{cfuncdesc}{int}{PyDict_Update}{PyObject *a, PyObject *b} +This is the same as \code{PyDict_Merge(\var{a}, \var{b}, 1)} in C, or +\code{\var{a}.update(\var{b})} in Python. Returns \code{0} on success +or \code{-1} if an exception was raised. +\versionadded{2.2} +\end{cfuncdesc} + \section{Other Objects \label{otherObjects}} |