equal
deleted
inserted
replaced
|
1 .. highlightlang:: c |
|
2 |
|
3 .. _gen-objects: |
|
4 |
|
5 Generator Objects |
|
6 ----------------- |
|
7 |
|
8 Generator objects are what Python uses to implement generator iterators. They |
|
9 are normally created by iterating over a function that yields values, rather |
|
10 than 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*. |