blob: 0d3789a25f1828363f4681bbb478bbba0ea54129 [file] [log] [blame]
Georg Brandl54a3faa2008-01-20 09:30:57 +00001.. 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 :cfunc:`PyGen_New`.
11
12
13.. ctype:: PyGenObject
14
15 The C structure used for generator objects.
16
17
18.. cvar:: PyTypeObject PyGen_Type
19
20 The type object corresponding to generator objects
21
22
23.. cfunction:: int PyGen_Check(ob)
24
25 Return true if *ob* is a generator object; *ob* must not be *NULL*.
26
27
28.. cfunction:: 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.. cfunction:: 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*.