[Python-checkins] CVS: python/dist/src/Doc/api concrete.tex,1.4,1.5

Tim Peters tim_one@users.sourceforge.net
Tue, 11 Dec 2001 10:51:10 -0800


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

Modified Files:
	concrete.tex 
Log Message:
SF bug #491415 PyDict_UpdateFromSeq2() unused
PyDict_UpdateFromSeq2():  removed it.
PyDict_MergeFromSeq2():  made it public and documented it.
PyDict_Merge() docs:  updated to reveal <wink> that the second
argument can be any mapping object.


Index: concrete.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** concrete.tex	2001/12/06 20:36:59	1.4
--- concrete.tex	2001/12/11 18:51:08	1.5
***************
*** 19,23 ****
  \section{Fundamental Objects \label{fundamental}}
  
! This section describes Python type objects and the singleton object 
  \code{None}.
  
--- 19,23 ----
  \section{Fundamental Objects \label{fundamental}}
  
! This section describes Python type objects and the singleton object
  \code{None}.
  
***************
*** 93,97 ****
  
  \begin{cvardesc}{PyTypeObject}{PyInt_Type}
!   This instance of \ctype{PyTypeObject} represents the Python plain 
    integer type.  This is the same object as \code{types.IntType}.
    \withsubitem{(in modules types)}{\ttindex{IntType}}
--- 93,97 ----
  
  \begin{cvardesc}{PyTypeObject}{PyInt_Type}
!   This instance of \ctype{PyTypeObject} represents the Python plain
    integer type.  This is the same object as \code{types.IntType}.
    \withsubitem{(in modules types)}{\ttindex{IntType}}
***************
*** 235,239 ****
    \constant{ULONG_MAX}\ttindex{ULONG_MAX}, an
    \exception{OverflowError} is raised.
!   \withsubitem{(built-in exception)}{\ttindex{OverflowError}} 
  \end{cfuncdesc}
  
--- 235,239 ----
    \constant{ULONG_MAX}\ttindex{ULONG_MAX}, an
    \exception{OverflowError} is raised.
!   \withsubitem{(built-in exception)}{\ttindex{OverflowError}}
  \end{cfuncdesc}
  
***************
*** 428,433 ****
  
  \obindex{sequence}
! Generic operations on sequence objects were discussed in the previous 
! chapter; this section deals with the specific kinds of sequence 
  objects that are intrinsic to the Python language.
  
--- 428,433 ----
  
  \obindex{sequence}
! Generic operations on sequence objects were discussed in the previous
! chapter; this section deals with the specific kinds of sequence
  objects that are intrinsic to the Python language.
  
***************
*** 796,800 ****
  
  \begin{cfuncdesc}{PyObject*}{PyUnicode_FromUnicode}{const Py_UNICODE *u,
!                                                     int size} 
    Create a Unicode Object from the Py_UNICODE buffer \var{u} of the
    given size. \var{u} may be \NULL{} which causes the contents to be
--- 796,800 ----
  
  \begin{cfuncdesc}{PyObject*}{PyUnicode_FromUnicode}{const Py_UNICODE *u,
!                                                     int size}
    Create a Unicode Object from the Py_UNICODE buffer \var{u} of the
    given size. \var{u} may be \NULL{} which causes the contents to be
***************
*** 1074,1078 ****
  \end{cfuncdesc}
  
! % --- Latin-1 Codecs ----------------------------------------------------- 
  
  These are the Latin-1 codec APIs:
--- 1074,1078 ----
  \end{cfuncdesc}
  
! % --- Latin-1 Codecs -----------------------------------------------------
  
  These are the Latin-1 codec APIs:
***************
*** 1102,1106 ****
  \end{cfuncdesc}
  
! % --- ASCII Codecs ------------------------------------------------------- 
  
  These are the \ASCII{} codec APIs.  Only 7-bit \ASCII{} data is
--- 1102,1106 ----
  \end{cfuncdesc}
  
! % --- ASCII Codecs -------------------------------------------------------
  
  These are the \ASCII{} codec APIs.  Only 7-bit \ASCII{} data is
***************
*** 1129,1133 ****
  \end{cfuncdesc}
  
! % --- Character Map Codecs ----------------------------------------------- 
  
  These are the mapping codec APIs:
--- 1129,1133 ----
  \end{cfuncdesc}
  
! % --- Character Map Codecs -----------------------------------------------
  
  These are the mapping codec APIs:
***************
*** 1140,1144 ****
  Decoding mappings must map single string characters to single Unicode
  characters, integers (which are then interpreted as Unicode ordinals)
! or None (meaning "undefined mapping" and causing an error). 
  
  Encoding mappings must map single Unicode characters to single string
--- 1140,1144 ----
  Decoding mappings must map single string characters to single Unicode
  characters, integers (which are then interpreted as Unicode ordinals)
! or None (meaning "undefined mapping" and causing an error).
  
  Encoding mappings must map single Unicode characters to single string
***************
*** 1357,1362 ****
  the object data directly, without needing to copy it first.
  
! Two examples of objects that support 
! the buffer interface are strings and arrays. The string object exposes 
  the character contents in the buffer interface's byte-oriented
  form. An array can also expose its contents, but it should be noted
--- 1357,1362 ----
  the object data directly, without needing to copy it first.
  
! Two examples of objects that support
! the buffer interface are strings and arrays. The string object exposes
  the character contents in the buffer interface's byte-oriented
  form. An array can also expose its contents, but it should be noted
***************
*** 1366,1370 ****
  \method{write()} method. Any object that can export a series of bytes
  through the buffer interface can be written to a file. There are a
! number of format codes to \cfunction{PyArg_ParseTuple()} that operate 
  against an object's buffer interface, returning data from the target
  object.
--- 1366,1370 ----
  \method{write()} method. Any object that can export a series of bytes
  through the buffer interface can be written to a file. There are a
! number of format codes to \cfunction{PyArg_ParseTuple()} that operate
  against an object's buffer interface, returning data from the target
  object.
***************
*** 1547,1551 ****
    \exception{MemoryError} or
    \exception{SystemError}.
!   \versionchanged[Removed unused third parameter, \var{last_is_sticky}]{2.2} 
  \end{cfuncdesc}
  
--- 1547,1551 ----
    \exception{MemoryError} or
    \exception{SystemError}.
!   \versionchanged[Removed unused third parameter, \var{last_is_sticky}]{2.2}
  \end{cfuncdesc}
  
***************
*** 1818,1826 ****
  
  \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}
--- 1818,1829 ----
  
  \begin{cfuncdesc}{int}{PyDict_Merge}{PyObject *a, PyObject *b, int override}
!   Iterate over mapping object \var{b} adding key-value pairs to dictionary
!   \var{a}.
!   \var{b} may be a dictionary, or any object supporting
!   \function{PyMapping_Keys()} and \function{PyObject_GetItem()}.
!   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}.
!   Return \code{0} on success or \code{-1} if an exception was
    raised.
  \versionadded{2.2}
***************
*** 1829,1838 ****
  \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}}
  
--- 1832,1861 ----
  \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.  Return \code{0} on
    success or \code{-1} if an exception was raised.
    \versionadded{2.2}
  \end{cfuncdesc}
  
+ \begin{cfuncdesc}{int}{PyDict_MergeFromSeq2}{PyObject *a, PyObject *seq2,
+                                              int override}
+   Update or merge into dictionary \var{a}, from the key-value pairs in
+   \var{seq2}.  \var{seq2} must be an iterable object producing
+   iterable objects of length 2, viewed as key-value pairs.  In case of
+   duplicate keys, the last wins if \var{override} is true, else the
+   first wins.
+   Return \code{0} on success or \code{-1} if an exception
+   was raised.
+   Equivalent Python (except for the return value):
+ 
+ \begin{verbatim}
+ def PyDict_MergeFromSeq2(a, seq2, override):
+     for key, value in seq2:
+         if override or key not in a:
+             a[key] = value
+ \end{verbatim}
  
+   \versionadded{2.2}
+ \end{cfuncdesc}
+ 
  \section{Other Objects \label{otherObjects}}
  
***************
*** 2301,2305 ****
  \obindex{CObject}
  Refer to \emph{Extending and Embedding the Python Interpreter},
! section 1.12 (``Providing a C API for an Extension Module), for more 
  information on using these objects.
  
--- 2324,2328 ----
  \obindex{CObject}
  Refer to \emph{Extending and Embedding the Python Interpreter},
! section 1.12 (``Providing a C API for an Extension Module), for more
  information on using these objects.
  
***************
*** 2318,2322 ****
  \end{cfuncdesc}
  
! \begin{cfuncdesc}{PyObject*}{PyCObject_FromVoidPtr}{void* cobj, 
  	                                            void (*destr)(void *)}
    Creates a \ctype{PyCObject} from the \code{void *}\var{cobj}.  The
--- 2341,2345 ----
  \end{cfuncdesc}
  
! \begin{cfuncdesc}{PyObject*}{PyCObject_FromVoidPtr}{void* cobj,
  	                                            void (*destr)(void *)}
    Creates a \ctype{PyCObject} from the \code{void *}\var{cobj}.  The