Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d61d0d3f
Commit
d61d0d3f
authored
Sep 23, 2001
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added API information for the PyCallIter_*() and PySeqIter_*() functions.
Added signatures for some new PyType_*() functions.
parent
13b49d33
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
1 deletion
+66
-1
Doc/api/api.tex
Doc/api/api.tex
+59
-1
Doc/api/refcounts.dat
Doc/api/refcounts.dat
+7
-0
No files found.
Doc/api/api.tex
View file @
d61d0d3f
...
...
@@ -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.
...
...
Doc/api/refcounts.dat
View file @
d61d0d3f
...
...
@@ -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:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment