• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. highlightlang:: c
2
3.. _gen-objects:
4
5Generator Objects
6-----------------
7
8Generator objects are what Python uses to implement generator iterators. They
9are normally created by iterating over a function that yields values, rather
10than explicitly calling :c:func:`PyGen_New`.
11
12
13.. c:type:: PyGenObject
14
15   The C structure used for generator objects.
16
17
18.. c:var:: PyTypeObject PyGen_Type
19
20   The type object corresponding to generator objects.
21
22
23.. c:function:: int PyGen_Check(ob)
24
25   Return true if *ob* is a generator object; *ob* must not be *NULL*.
26
27
28.. c:function:: int PyGen_CheckExact(ob)
29
30   Return true if *ob*'s type is *PyGen_Type* is a generator object; *ob* must not
31   be *NULL*.
32
33
34.. c:function:: PyObject* PyGen_New(PyFrameObject *frame)
35
36   Create and return a new generator object based on the *frame* object. A
37   reference to *frame* is stolen by this function. The parameter must not be
38   *NULL*.
39