summaryrefslogtreecommitdiffstats
path: root/Doc/api
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-09-23 02:05:26 (GMT)
committerFred Drake <fdrake@acm.org>2001-09-23 02:05:26 (GMT)
commitd61d0d3f6dbd960a761c05ff7fea848cb6490aa3 (patch)
tree072b03e28f8637b204731461b3681b51db80729b /Doc/api
parent13b49d3374cca4eaffee5fa756192a234714c8ff (diff)
downloadcpython-d61d0d3f6dbd960a761c05ff7fea848cb6490aa3.zip
cpython-d61d0d3f6dbd960a761c05ff7fea848cb6490aa3.tar.gz
cpython-d61d0d3f6dbd960a761c05ff7fea848cb6490aa3.tar.bz2
Added API information for the PyCallIter_*() and PySeqIter_*() functions.
Added signatures for some new PyType_*() functions.
Diffstat (limited to 'Doc/api')
-rw-r--r--Doc/api/api.tex60
-rw-r--r--Doc/api/refcounts.dat7
2 files changed, 66 insertions, 1 deletions
diff --git a/Doc/api/api.tex b/Doc/api/api.tex
index 7b205ca..a727041 100644
--- a/Doc/api/api.tex
+++ b/Doc/api/api.tex
@@ -2337,6 +2337,18 @@ Returns true if the type object \var{o} sets the feature
\var{feature}. Type features are denoted by single bit flags.
\end{cfuncdesc}
+\begin{cfuncdesc}{int}{PyType_IsSubtype}{PyTypeObject *a, PyTypeObject *b}
+Returns true if \var{a} is a subtype of \var{b}.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{PyObject*}{PyType_GenericAlloc}{PyTypeObject *type,
+ int nitems}
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{PyObject*}{PyType_GenericNew}{PyTypeObject *type,
+ PyObject *args, PyObject *kwds}
+\end{cfuncdesc}
+
\subsection{The None Object \label{noneObject}}
@@ -4356,11 +4368,57 @@ error, \code{0} on success.
\end{cfuncdesc}
+\subsection{Iterator Objects \label{iterator-objects}}
+
+Python provides two general-purpose iterator objects. The first, a
+sequence iterator, works with an arbitrary sequence supporting the
+\method{__getitem__()} method. The second works with a callable
+object and a sentinel value, calling the callable for each item in the
+sequence, and ending the iteration when the sentinel value is
+returned.
+
+\begin{cvardesc}{PyTypeObject}{PySeqIter_Type}
+ Type object for iterator objects returned by
+ \cfunction{PySeqIter_New()} and the one-argument form of the
+ \function{iter()} built-in function for built-in sequence types.
+\end{cvardesc}
+
+\begin{cfuncdesc}{int}{PySeqIter_Check}{op}
+ Return true if the type of \var{op} is \cdata{PySeqIter_Type}.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{PyObject*}{PySeqIter_New}{PyObject *seq}
+ Return an iterator that works with a general sequence object,
+ \var{seq}. The iteration ends when the sequence raises
+ \exception{IndexError} for the subscripting operation.
+\end{cfuncdesc}
+
+
+\begin{cvardesc}{PyTypeObject}{PyCallIter_Type}
+ Type object for iterator objects returned by
+ \cfunction{PyCallIter_New()} and the two-argument form of the
+ \function{iter()} built-in function.
+\end{cvardesc}
+
+\begin{cfuncdesc}{int}{PyCallIter_Check}{op}
+ Return true if the type of \var{op} is \cdata{PyCallIter_Type}.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{PyObject*}{PyCallIter_New}{PyObject *callable,
+ PyObject *sentinel}
+ Return a new iterator. The first parameter, \var{callable}, can be
+ any Python callable object that can be called with no parameters;
+ each call to it should return the next item in the iteration. When
+ \var{callable} returns a value equal to \var{sentinel}, the
+ iteration will be terminated.
+\end{cfuncdesc}
+
+
\subsection{CObjects \label{cObjects}}
\obindex{CObject}
Refer to \emph{Extending and Embedding the Python Interpreter},
-section 1.12 (``Providing a C API for an Extension Module''), for more
+section 1.12 (``Providing a C API for an Extension Module), for more
information on using these objects.
diff --git a/Doc/api/refcounts.dat b/Doc/api/refcounts.dat
index 5f16800..fa4fe4f 100644
--- a/Doc/api/refcounts.dat
+++ b/Doc/api/refcounts.dat
@@ -67,6 +67,10 @@ PyCObject_FromVoidPtrAndDesc:void(*)(void*,void*):destr::
PyCObject_GetDesc:void*:::
PyCObject_GetDesc:PyObject*:self:0:
+PyCallIter_New:PyObject*::+1:
+PyCallIter_New:PyObject*:callable::
+PyCallIter_New:PyObject*:sentinel::
+
PyCallable_Check:int:::
PyCallable_Check:PyObject*:o:0:
@@ -845,6 +849,9 @@ PyRun_String:int:start::
PyRun_String:PyObject*:globals:0:
PyRun_String:PyObject*:locals:0:
+PySeqIter_New:PyObject*::+1:
+PySeqIter_New:PyObject*:seq::
+
PySequence_Check:int:::
PySequence_Check:PyObject*:o:0: