Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 11ee902

Browse files
committed
Added documentation for PyDict_Update() and PyDict_Merge().
1 parent e45763a commit 11ee902

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

Doc/api/api.tex

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3782,6 +3782,7 @@ \subsection{Dictionary Objects \label{dictObjects}}
37823782
\begin{cfuncdesc}{PyObject*}{PyDict_Copy}{PyObject *p}
37833783
Returns a new dictionary that contains the same key-value pairs as p.
37843784
Empties an existing dictionary of all key-value pairs.
3785+
\versionadded{1.6}
37853786
\end{cfuncdesc}
37863787

37873788
\begin{cfuncdesc}{int}{PyDict_SetItem}{PyObject *p, PyObject *key,
@@ -3874,7 +3875,8 @@ \subsection{Dictionary Objects \label{dictObjects}}
38743875

38753876
The dictionary \var{p} should not be mutated during iteration. It is
38763877
safe (since Python 2.1) to modify the values of the keys as you
3877-
iterate over the dictionary, for example:
3878+
iterate over the dictionary, but only so long as the set of keys does
3879+
not change. For example:
38783880

38793881
\begin{verbatim}
38803882
PyObject *key, *value;
@@ -3894,6 +3896,22 @@ \subsection{Dictionary Objects \label{dictObjects}}
38943896
\end{verbatim}
38953897
\end{cfuncdesc}
38963898

3899+
\begin{cfuncdesc}{int}{PyDict_Merge}{PyObject *a, PyObject *b, int override}
3900+
Iterate over dictionary \var{b} adding key-value pairs to dictionary
3901+
\var{a}. If \var{override} is true, existing pairs in \var{a} will be
3902+
replaced if a matching key is found in \var{b}, otherwise pairs will
3903+
only be added if there is not a matching key in \var{a}. Returns
3904+
\code{0} on success or \code{-1} if an exception was raised.
3905+
\versionadded{2.2}
3906+
\end{cfuncdesc}
3907+
3908+
\begin{cfuncdesc}{int}{PyDict_Update}{PyObject *a, PyObject *b}
3909+
This is the same as \code{PyDict_Merge(\var{a}, \var{b}, 1)} in C, or
3910+
\code{\var{a}.update(\var{b})} in Python. Returns \code{0} on success
3911+
or \code{-1} if an exception was raised.
3912+
\versionadded{2.2}
3913+
\end{cfuncdesc}
3914+
38973915

38983916
\section{Other Objects \label{otherObjects}}
38993917

0 commit comments

Comments
 (0)