]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-141004: Document built-in iterator types in the C API (GH-141006)
authorPeter Bierma <zintensitydev@gmail.com>
Thu, 6 Nov 2025 12:29:04 +0000 (07:29 -0500)
committerGitHub <noreply@github.com>
Thu, 6 Nov 2025 12:29:04 +0000 (07:29 -0500)
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.

Doc/c-api/iterator.rst

index 4b94970036f543df7e98fccd6aee60e43726a53d..7eaf72ec55fd7715baf51b371cd8b0ecec37d3ba 100644 (file)
@@ -52,6 +52,45 @@ sentinel value is returned.
    *sentinel*, the iteration will be terminated.
 
 
+Range Objects
+^^^^^^^^^^^^^
+
+.. c:var:: PyTypeObject PyRange_Type
+
+   The type object for :class:`range` objects.
+
+
+.. c:function:: int PyRange_Check(PyObject *o)
+
+   Return true if the object *o* is an instance of a :class:`range` object.
+   This function always succeeds.
+
+
+Builtin Iterator Types
+^^^^^^^^^^^^^^^^^^^^^^
+
+These are built-in iteration types that are included in Python's C API, but
+provide no additional functions. They are here for completeness.
+
+
+.. list-table::
+   :widths: auto
+   :header-rows: 1
+
+   * * C type
+     * Python type
+   * * .. c:var:: PyTypeObject PyEnum_Type
+     * :py:class:`enumerate`
+   * * .. c:var:: PyTypeObject PyFilter_Type
+     * :py:class:`filter`
+   * * .. c:var:: PyTypeObject PyMap_Type
+     * :py:class:`map`
+   * * .. c:var:: PyTypeObject PyReversed_Type
+     * :py:class:`reversed`
+   * * .. c:var:: PyTypeObject PyZip_Type
+     * :py:class:`zip`
+
+
 Other Iterator Objects
 ^^^^^^^^^^^^^^^^^^^^^^