diff options
author | Raymond Hettinger <python@rcn.com> | 2003-12-13 11:26:12 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-12-13 11:26:12 (GMT) |
commit | 8f5cdaa784f555149adf5e94fd2e989f99d6b1db (patch) | |
tree | d6a8f66d75cc46f849b5933fb2a57b41e76a7d4f /Doc | |
parent | feb78c94fa444a75b912ca355c3c80d7453f03f0 (diff) | |
download | cpython-8f5cdaa784f555149adf5e94fd2e989f99d6b1db.zip cpython-8f5cdaa784f555149adf5e94fd2e989f99d6b1db.tar.gz cpython-8f5cdaa784f555149adf5e94fd2e989f99d6b1db.tar.bz2 |
* Added a new method flag, METH_COEXIST.
* Used the flag to optimize set.__contains__(), dict.__contains__(),
dict.__getitem__(), and list.__getitem__().
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/api/newtypes.tex | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Doc/api/newtypes.tex b/Doc/api/newtypes.tex index 1fadc46..038cce9 100644 --- a/Doc/api/newtypes.tex +++ b/Doc/api/newtypes.tex @@ -306,6 +306,21 @@ may be set for any given method. \versionadded{2.3} \end{datadesc} +One other constant controls whether a method is loaded in place of +another definition with the same method name. + +\begin{datadesc}{METH_COEXIST} + The method will be loaded in place of existing definitions. Without + \var{METH_COEXIST}, the default is to skip repeated definitions. Since + slot wrappers are loaded before the method table, the existence of a + \var{sq_contains} slot, for example, would generate a wrapped method + named \method{__contains__()} and preclude the loading of a + corresponding PyCFunction with the same name. With the flag defined, + the PyCFunction will be loaded in place of the wrapper object and will + co-exist with the slot. This is helpful because calls to PyCFunctions + are optimized more than wrapper object calls. + \versionadded{2.4} +\end{datadesc} \begin{cfuncdesc}{PyObject*}{Py_FindMethod}{PyMethodDef table[], PyObject *ob, char *name} |