Mercurial > cpython-lru_cache-weakref
diff Doc/api/api.tex @ 19156:776628eea8f7 legacy-trunk
Added documentation for PyDict_Update() and PyDict_Merge().
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Fri, 10 Aug 2001 21:31:12 +0000 |
| parents | 67be3a68fde4 |
| children | d99c1240d0ac |
line wrap: on
line diff
--- a/Doc/api/api.tex Fri Aug 10 21:28:46 2001 +0000 +++ b/Doc/api/api.tex Fri Aug 10 21:31:12 2001 +0000 @@ -3782,6 +3782,7 @@ \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 @@ 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 @@ \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}}
