Skip to content

Commit 1697cb5

Browse files
gh-141004: Document built-in iterator types in the C API (GH-141006)
Adds documentation for each of the following: - PyEnum_Type - PyFilter_Type - PyMap_Type - PyReversed_Type - PyZip_Type In addition, PyRange_Type and PyRange_Check are also documented.
1 parent d2ce6d7 commit 1697cb5

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Doc/c-api/iterator.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,45 @@ sentinel value is returned.
5252
*sentinel*, the iteration will be terminated.
5353
5454
55+
Range Objects
56+
^^^^^^^^^^^^^
57+
58+
.. c:var:: PyTypeObject PyRange_Type
59+
60+
The type object for :class:`range` objects.
61+
62+
63+
.. c:function:: int PyRange_Check(PyObject *o)
64+
65+
Return true if the object *o* is an instance of a :class:`range` object.
66+
This function always succeeds.
67+
68+
69+
Builtin Iterator Types
70+
^^^^^^^^^^^^^^^^^^^^^^
71+
72+
These are built-in iteration types that are included in Python's C API, but
73+
provide no additional functions. They are here for completeness.
74+
75+
76+
.. list-table::
77+
:widths: auto
78+
:header-rows: 1
79+
80+
* * C type
81+
* Python type
82+
* * .. c:var:: PyTypeObject PyEnum_Type
83+
* :py:class:`enumerate`
84+
* * .. c:var:: PyTypeObject PyFilter_Type
85+
* :py:class:`filter`
86+
* * .. c:var:: PyTypeObject PyMap_Type
87+
* :py:class:`map`
88+
* * .. c:var:: PyTypeObject PyReversed_Type
89+
* :py:class:`reversed`
90+
* * .. c:var:: PyTypeObject PyZip_Type
91+
* :py:class:`zip`
92+
93+
5594
Other Iterator Objects
5695
^^^^^^^^^^^^^^^^^^^^^^
5796

0 commit comments

Comments
 (0)