1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
<html xmlns="http://www.w3.org/1999/xhtml">
7
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
<title>Generator Objects — Python 2.7.12 documentation</title>
11
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
12
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
14
<script type="text/javascript">
15
var DOCUMENTATION_OPTIONS = {
18
COLLAPSE_INDEX: false,
23
<script type="text/javascript" src="../_static/jquery.js"></script>
24
<script type="text/javascript" src="../_static/underscore.js"></script>
25
<script type="text/javascript" src="../_static/doctools.js"></script>
26
<script type="text/javascript" src="../_static/sidebar.js"></script>
27
<link rel="search" type="application/opensearchdescription+xml"
28
title="Search within Python 2.7.12 documentation"
29
href="../_static/opensearch.xml"/>
30
<link rel="author" title="About these documents" href="../about.html" />
31
<link rel="copyright" title="Copyright" href="../copyright.html" />
32
<link rel="top" title="Python 2.7.12 documentation" href="../contents.html" />
33
<link rel="up" title="Concrete Objects Layer" href="concrete.html" />
34
<link rel="next" title="DateTime Objects" href="datetime.html" />
35
<link rel="prev" title="Cell Objects" href="cell.html" />
36
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
37
<script type="text/javascript" src="../_static/copybutton.js"></script>
38
<script type="text/javascript" src="../_static/version_switch.js"></script>
43
<body role="document">
44
<div class="related" role="navigation" aria-label="related navigation">
47
<li class="right" style="margin-right: 10px">
48
<a href="../genindex.html" title="General Index"
49
accesskey="I">index</a></li>
51
<a href="../py-modindex.html" title="Python Module Index"
54
<a href="datetime.html" title="DateTime Objects"
55
accesskey="N">next</a> |</li>
57
<a href="cell.html" title="Cell Objects"
58
accesskey="P">previous</a> |</li>
59
<li><img src="../_static/py.png" alt=""
60
style="vertical-align: middle; margin-top: -1px"/></li>
61
<li><a href="https://www.python.org/">Python</a> »</li>
63
<span class="version_switcher_placeholder">2.7.12</span>
64
<a href="../index.html">Documentation</a> »
67
<li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> »</li>
68
<li class="nav-item nav-item-2"><a href="concrete.html" accesskey="U">Concrete Objects Layer</a> »</li>
72
<div class="document">
73
<div class="documentwrapper">
74
<div class="bodywrapper">
75
<div class="body" role="main">
77
<div class="section" id="generator-objects">
78
<span id="gen-objects"></span><h1>Generator Objects<a class="headerlink" href="#generator-objects" title="Permalink to this headline">¶</a></h1>
79
<p>Generator objects are what Python uses to implement generator iterators. They
80
are normally created by iterating over a function that yields values, rather
81
than explicitly calling <a class="reference internal" href="#c.PyGen_New" title="PyGen_New"><code class="xref c c-func docutils literal"><span class="pre">PyGen_New()</span></code></a>.</p>
83
<dt id="c.PyGenObject">
84
<code class="descname">PyGenObject</code><a class="headerlink" href="#c.PyGenObject" title="Permalink to this definition">¶</a></dt>
85
<dd><p>The C structure used for generator objects.</p>
89
<dt id="c.PyGen_Type">
90
<a class="reference internal" href="type.html#c.PyTypeObject" title="PyTypeObject">PyTypeObject</a> <code class="descname">PyGen_Type</code><a class="headerlink" href="#c.PyGen_Type" title="Permalink to this definition">¶</a></dt>
91
<dd><p>The type object corresponding to generator objects.</p>
95
<dt id="c.PyGen_Check">
96
int <code class="descname">PyGen_Check</code><span class="sig-paren">(</span>ob<span class="sig-paren">)</span><a class="headerlink" href="#c.PyGen_Check" title="Permalink to this definition">¶</a></dt>
97
<dd><p>Return true if <em>ob</em> is a generator object; <em>ob</em> must not be <em>NULL</em>.</p>
100
<dl class="function">
101
<dt id="c.PyGen_CheckExact">
102
int <code class="descname">PyGen_CheckExact</code><span class="sig-paren">(</span>ob<span class="sig-paren">)</span><a class="headerlink" href="#c.PyGen_CheckExact" title="Permalink to this definition">¶</a></dt>
103
<dd><p>Return true if <em>ob</em>‘s type is <em>PyGen_Type</em> is a generator object; <em>ob</em> must not
104
be <em>NULL</em>.</p>
107
<dl class="function">
108
<dt id="c.PyGen_New">
109
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a>* <code class="descname">PyGen_New</code><span class="sig-paren">(</span>PyFrameObject<em> *frame</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyGen_New" title="Permalink to this definition">¶</a></dt>
110
<dd><em class="refcount">Return value: New reference.</em><p>Create and return a new generator object based on the <em>frame</em> object. A
111
reference to <em>frame</em> is stolen by this function. The parameter must not be
121
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
122
<div class="sphinxsidebarwrapper">
123
<h4>Previous topic</h4>
124
<p class="topless"><a href="cell.html"
125
title="previous chapter">Cell Objects</a></p>
127
<p class="topless"><a href="datetime.html"
128
title="next chapter">DateTime Objects</a></p>
130
<ul class="this-page-menu">
131
<li><a href="../bugs.html">Report a Bug</a></li>
132
<li><a href="../_sources/c-api/gen.txt"
133
rel="nofollow">Show Source</a></li>
136
<div id="searchbox" style="display: none" role="search">
137
<h3>Quick search</h3>
138
<form class="search" action="../search.html" method="get">
139
<input type="text" name="q" />
140
<input type="submit" value="Go" />
141
<input type="hidden" name="check_keywords" value="yes" />
142
<input type="hidden" name="area" value="default" />
144
<p class="searchtip" style="font-size: 90%">
145
Enter search terms or a module, class or function name.
148
<script type="text/javascript">$('#searchbox').show(0);</script>
151
<div class="clearer"></div>
153
<div class="related" role="navigation" aria-label="related navigation">
156
<li class="right" style="margin-right: 10px">
157
<a href="../genindex.html" title="General Index"
160
<a href="../py-modindex.html" title="Python Module Index"
163
<a href="datetime.html" title="DateTime Objects"
166
<a href="cell.html" title="Cell Objects"
168
<li><img src="../_static/py.png" alt=""
169
style="vertical-align: middle; margin-top: -1px"/></li>
170
<li><a href="https://www.python.org/">Python</a> »</li>
172
<span class="version_switcher_placeholder">2.7.12</span>
173
<a href="../index.html">Documentation</a> »
176
<li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> »</li>
177
<li class="nav-item nav-item-2"><a href="concrete.html" >Concrete Objects Layer</a> »</li>
181
© <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
183
The Python Software Foundation is a non-profit corporation.
184
<a href="https://www.python.org/psf/donations/">Please donate.</a>
186
Last updated on Sep 20, 2016.
187
<a href="../bugs.html">Found a bug</a>?
189
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
b'\\ No newline at end of file'