イテレータオブジェクト (iterator object)
****************************************

Python では二種類のイテレータオブジェクトを提供しています。一つ目はシ
ーケンスイテレータで、 "__getitem__()" メソッドをサポートする任意のシ
ーケンスを取り扱います。二つ目は呼び出し可能オブジェクトと番兵
(sentinel value) を扱い、シーケンス内の要素ごとに呼び出し可能オブジェ
クトを呼び出して、センチネル値が返されたときに反復処理を終了します。

PyTypeObject PySeqIter_Type
    * 次に属します: Stable ABI.*

   "PySeqIter_New()" や、組み込みシーケンス型に対して 1 引数形式の組み
   込み関数 "iter()" を呼び出したときに返される、イテレータオブジェク
   トの型オブジェクトです。

int PySeqIter_Check(PyObject *op)

   *op* の型が "PySeqlter_Type" 型の場合に真を返します。この関数は常に
   成功します。

PyObject *PySeqIter_New(PyObject *seq)
    *戻り値: 新しい参照。** 次に属します: Stable ABI.*

   一般的なシーケンスオブジェクト *seq* を扱うイテレータを返します。反
   復処理は、シーケンスが添字指定操作の際に "IndexError" を返したとき
   に終了します。

PyTypeObject PyCallIter_Type
    * 次に属します: Stable ABI.*

   "PyCallIter_New()" や、組み込み関数 "iter()" の 2 引数形式が返すイ
   テレータオブジェクトの型オブジェクトです。

int PyCallIter_Check(PyObject *op)

   *op* の型が "PyCallIter_Type" 型の場合に真を返します。この関数は常
   に成功します。

PyObject *PyCallIter_New(PyObject *callable, PyObject *sentinel)
    *戻り値: 新しい参照。** 次に属します: Stable ABI.*

   新たなイテレータを返します。最初のパラメタ *callable* は引数なしで
   呼び出せる Python の呼び出し可能オブジェクトならなんでもかまいませ
   ん; *callable* は、呼び出されるたびに次の反復処理対象オブジェクトを
   返さなければなりません。生成されたイテレータは、*callable* が
   *sentinel* に等しい値を返すと反復処理を終了します。


Range Objects
=============

PyTypeObject PyRange_Type
    * 次に属します: Stable ABI.*

   The type object for "range" objects.

int PyRange_Check(PyObject *o)

   Return true if the object *o* is an instance of a "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.

+----------------------------------------------------+----------------------------------------------------+
| C の型                                             | Python の型                                        |
|====================================================|====================================================|
| PyTypeObject PyEnum_Type  * 次に属します: Stable   | "enumerate"                                        |
| ABI.*                                              |                                                    |
+----------------------------------------------------+----------------------------------------------------+
| PyTypeObject PyFilter_Type  * 次に属します: Stable | "filter"                                           |
| ABI.*                                              |                                                    |
+----------------------------------------------------+----------------------------------------------------+
| PyTypeObject PyMap_Type  * 次に属します: Stable    | "map"                                              |
| ABI.*                                              |                                                    |
+----------------------------------------------------+----------------------------------------------------+
| PyTypeObject PyReversed_Type  * 次に属します:      | "reversed"                                         |
| Stable ABI.*                                       |                                                    |
+----------------------------------------------------+----------------------------------------------------+
| PyTypeObject PyZip_Type  * 次に属します: Stable    | "zip"                                              |
| ABI.*                                              |                                                    |
+----------------------------------------------------+----------------------------------------------------+


Other Iterator Objects
======================

PyTypeObject PyByteArrayIter_Type
    * 次に属します: Stable ABI.*

PyTypeObject PyBytesIter_Type
    * 次に属します: Stable ABI.*

PyTypeObject PyListIter_Type
    * 次に属します: Stable ABI.*

PyTypeObject PyListRevIter_Type
    * 次に属します: Stable ABI.*

PyTypeObject PySetIter_Type
    * 次に属します: Stable ABI.*

PyTypeObject PyTupleIter_Type
    * 次に属します: Stable ABI.*

PyTypeObject PyRangeIter_Type
    * 次に属します: Stable ABI.*

PyTypeObject PyLongRangeIter_Type
    * 次に属します: Stable ABI.*

PyTypeObject PyDictIterKey_Type
    * 次に属します: Stable ABI.*

PyTypeObject PyDictRevIterKey_Type
    * 次に属します: Stable ABI (バージョン 3.8 より).*

PyTypeObject PyDictIterValue_Type
    * 次に属します: Stable ABI.*

PyTypeObject PyDictRevIterValue_Type
    * 次に属します: Stable ABI (バージョン 3.8 より).*

PyTypeObject PyDictIterItem_Type
    * 次に属します: Stable ABI.*

PyTypeObject PyDictRevIterItem_Type
    * 次に属します: Stable ABI (バージョン 3.8 より).*

PyTypeObject PyODictIter_Type

   Type objects for iterators of various built-in objects.

   Do not create instances of these directly; prefer calling
   "PyObject_GetIter()" instead.

   Note that there is no guarantee that a given built-in type uses a
   given iterator type. For example, iterating over "range" will use
   one of two iterator types depending on the size of the range. Other
   types may start using a similar scheme in the future, without
   warning.
