Generator Objects

Generator objects are what Python uses to implement generator iterators. Theyare normally created by iterating over a function that yields values, ratherthan explicitly callingPyGen_New() orPyGen_NewWithQualName().

typePyGenObject

The C structure used for generator objects.

PyTypeObjectPyGen_Type

The type object corresponding to generator objects.

intPyGen_Check(PyObject*ob)

Return true ifob is a generator object;ob must not beNULL. Thisfunction always succeeds.

intPyGen_CheckExact(PyObject*ob)

Return true ifob’s type isPyGen_Type;ob must not beNULL. This function always succeeds.

PyObject*PyGen_New(PyFrameObject*frame)
Return value: New reference.

Create and return a new generator object based on theframe object.A reference toframe is stolen by this function. The argument must not beNULL.

PyObject*PyGen_NewWithQualName(PyFrameObject*frame,PyObject*name,PyObject*qualname)
Return value: New reference.

Create and return a new generator object based on theframe object,with__name__ and__qualname__ set toname andqualname.A reference toframe is stolen by this function. Theframe argumentmust not beNULL.