diff options
author | Raymond Hettinger <python@rcn.com> | 2003-11-25 21:12:14 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-11-25 21:12:14 (GMT) |
commit | bc0f2ab9bbe1380a32cc63823258a337a525fb32 (patch) | |
tree | 4e0f76ebe43b74cab10b1e6bd41b1d90fe6f8230 /Doc | |
parent | 3972457de72fa6d95d94df14a3bb402798aa092c (diff) | |
download | cpython-bc0f2ab9bbe1380a32cc63823258a337a525fb32.zip cpython-bc0f2ab9bbe1380a32cc63823258a337a525fb32.tar.gz cpython-bc0f2ab9bbe1380a32cc63823258a337a525fb32.tar.bz2 |
Expose dict_contains() and PyDict_Contains() with is about 10% faster
than PySequence_Contains() and more clearly applicable to dicts.
Apply the new function in setobject.c where __contains__ checking is
ubiquitous.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/api/concrete.tex | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/api/concrete.tex b/Doc/api/concrete.tex index bf8d438..67852db 100644 --- a/Doc/api/concrete.tex +++ b/Doc/api/concrete.tex @@ -1808,6 +1808,14 @@ format. Empties an existing dictionary of all key-value pairs. \end{cfuncdesc} +\begin{cfuncdesc}{int}{PyDict_Contains}{PyObject *p, PyObject *key} + Determine if dictionary \var{p} contains \var{key}. If an item + in \var{p} is matches \var{key}, return \code{1}, otherwise return + \code{0}. On error, return \code{-1}. This is equivalent to the + Python expression \samp{\var{key} in \var{p}}. + \versionadded{2.4} +\end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PyDict_Copy}{PyObject *p} Returns a new dictionary that contains the same key-value pairs as \var{p}. |