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().
PyGenObject¶The C structure used for generator objects.
- PyTypeObject
PyGen_Type¶ The type object corresponding to generator objects.
- int
PyGen_Check(PyObject *ob)¶ Return true ifob is a generator object;ob must not be
NULL. Thisfunction always succeeds.
- int
PyGen_CheckExact(PyObject *ob)¶ Return true ifob’s type is
PyGen_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 be
NULL.
- 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.