[Python-checkins] python/dist/src/Doc/api newtypes.tex,1.27,1.28

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Sat Dec 13 06:26:13 EST 2003


Update of /cvsroot/python/python/dist/src/Doc/api
In directory sc8-pr-cvs1:/tmp/cvs-serv7484/Doc/api

Modified Files:
	newtypes.tex 
Log Message:
* Added a new method flag, METH_COEXIST.

* Used the flag to optimize set.__contains__(), dict.__contains__(),
  dict.__getitem__(), and list.__getitem__().



Index: newtypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** newtypes.tex	7 Dec 2003 12:49:48 -0000	1.27
--- newtypes.tex	13 Dec 2003 11:26:10 -0000	1.28
***************
*** 307,310 ****
--- 307,325 ----
  \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[],





More information about the Python-checkins mailing list