產生器物件¶
生成器对象是Python用来实现生成器迭代器的对象。它们通常通过迭代产生值的函数来创建,而不是显式调用 PyGen_New()
或 PyGen_NewWithQualName()
。
-
PyGenObject
¶ 用于生成器对象的C结构体。
-
PyTypeObject
PyGen_Type
¶ 与生成器对象对应的类型对象。
-
PyObject*
PyGen_New
(PyFrameObject *frame)¶ - Return value: New reference.
Create and return a new generator object based on the frame object. A reference to frame 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 the frame object, with
__name__
and__qualname__
set to name and qualname. A reference to frame is stolen by this function. The frame argument must not be NULL.