~dkuhlman/python-training-materials/Materials

« back to all changes in this revision

Viewing changes to python-2.7.12-docs-html/c-api/cell.html

  • Committer: Dave Kuhlman
  • Date: 2017-04-15 16:24:56 UTC
  • Revision ID: dkuhlman@davekuhlman.org-20170415162456-iav9vozzg4iwqwv3
Updated docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
2
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
3
 
 
4
 
 
5
<html xmlns="http://www.w3.org/1999/xhtml">
 
6
  <head>
 
7
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
8
    
 
9
    <title>Cell Objects &mdash; Python 2.7.12 documentation</title>
 
10
    
 
11
    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
 
12
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
 
13
    
 
14
    <script type="text/javascript">
 
15
      var DOCUMENTATION_OPTIONS = {
 
16
        URL_ROOT:    '../',
 
17
        VERSION:     '2.7.12',
 
18
        COLLAPSE_INDEX: false,
 
19
        FILE_SUFFIX: '.html',
 
20
        HAS_SOURCE:  true
 
21
      };
 
22
    </script>
 
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="Generator Objects" href="gen.html" />
 
35
    <link rel="prev" title="CObjects" href="cobject.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>
 
39
 
 
40
    
 
41
 
 
42
  </head>
 
43
  <body role="document">  
 
44
    <div class="related" role="navigation" aria-label="related navigation">
 
45
      <h3>Navigation</h3>
 
46
      <ul>
 
47
        <li class="right" style="margin-right: 10px">
 
48
          <a href="../genindex.html" title="General Index"
 
49
             accesskey="I">index</a></li>
 
50
        <li class="right" >
 
51
          <a href="../py-modindex.html" title="Python Module Index"
 
52
             >modules</a> |</li>
 
53
        <li class="right" >
 
54
          <a href="gen.html" title="Generator Objects"
 
55
             accesskey="N">next</a> |</li>
 
56
        <li class="right" >
 
57
          <a href="cobject.html" title="CObjects"
 
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> &raquo;</li>
 
62
        <li>
 
63
          <span class="version_switcher_placeholder">2.7.12</span>
 
64
          <a href="../index.html">Documentation</a> &raquo;
 
65
        </li>
 
66
 
 
67
          <li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> &raquo;</li>
 
68
          <li class="nav-item nav-item-2"><a href="concrete.html" accesskey="U">Concrete Objects Layer</a> &raquo;</li> 
 
69
      </ul>
 
70
    </div>    
 
71
 
 
72
    <div class="document">
 
73
      <div class="documentwrapper">
 
74
        <div class="bodywrapper">
 
75
          <div class="body" role="main">
 
76
            
 
77
  <div class="section" id="cell-objects">
 
78
<span id="id1"></span><h1>Cell Objects<a class="headerlink" href="#cell-objects" title="Permalink to this headline">¶</a></h1>
 
79
<p>&#8220;Cell&#8221; objects are used to implement variables referenced by multiple scopes.
 
80
For each such variable, a cell object is created to store the value; the local
 
81
variables of each stack frame that references the value contains a reference to
 
82
the cells from outer scopes which also use that variable.  When the value is
 
83
accessed, the value contained in the cell is used instead of the cell object
 
84
itself.  This de-referencing of the cell object requires support from the
 
85
generated byte-code; these are not automatically de-referenced when accessed.
 
86
Cell objects are not likely to be useful elsewhere.</p>
 
87
<dl class="type">
 
88
<dt id="c.PyCellObject">
 
89
<code class="descname">PyCellObject</code><a class="headerlink" href="#c.PyCellObject" title="Permalink to this definition">¶</a></dt>
 
90
<dd><p>The C structure used for cell objects.</p>
 
91
</dd></dl>
 
92
 
 
93
<dl class="var">
 
94
<dt id="c.PyCell_Type">
 
95
<a class="reference internal" href="type.html#c.PyTypeObject" title="PyTypeObject">PyTypeObject</a> <code class="descname">PyCell_Type</code><a class="headerlink" href="#c.PyCell_Type" title="Permalink to this definition">¶</a></dt>
 
96
<dd><p>The type object corresponding to cell objects.</p>
 
97
</dd></dl>
 
98
 
 
99
<dl class="function">
 
100
<dt id="c.PyCell_Check">
 
101
int <code class="descname">PyCell_Check</code><span class="sig-paren">(</span>ob<span class="sig-paren">)</span><a class="headerlink" href="#c.PyCell_Check" title="Permalink to this definition">¶</a></dt>
 
102
<dd><p>Return true if <em>ob</em> is a cell object; <em>ob</em> must not be <em>NULL</em>.</p>
 
103
</dd></dl>
 
104
 
 
105
<dl class="function">
 
106
<dt id="c.PyCell_New">
 
107
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a>* <code class="descname">PyCell_New</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*ob</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyCell_New" title="Permalink to this definition">¶</a></dt>
 
108
<dd><em class="refcount">Return value: New reference.</em><p>Create and return a new cell object containing the value <em>ob</em>. The parameter may
 
109
be <em>NULL</em>.</p>
 
110
</dd></dl>
 
111
 
 
112
<dl class="function">
 
113
<dt id="c.PyCell_Get">
 
114
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a>* <code class="descname">PyCell_Get</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*cell</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyCell_Get" title="Permalink to this definition">¶</a></dt>
 
115
<dd><em class="refcount">Return value: New reference.</em><p>Return the contents of the cell <em>cell</em>.</p>
 
116
</dd></dl>
 
117
 
 
118
<dl class="function">
 
119
<dt id="c.PyCell_GET">
 
120
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a>* <code class="descname">PyCell_GET</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*cell</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyCell_GET" title="Permalink to this definition">¶</a></dt>
 
121
<dd><em class="refcount">Return value: Borrowed reference.</em><p>Return the contents of the cell <em>cell</em>, but without checking that <em>cell</em> is
 
122
non-<em>NULL</em> and a cell object.</p>
 
123
</dd></dl>
 
124
 
 
125
<dl class="function">
 
126
<dt id="c.PyCell_Set">
 
127
int <code class="descname">PyCell_Set</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*cell</em>, <a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*value</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyCell_Set" title="Permalink to this definition">¶</a></dt>
 
128
<dd><p>Set the contents of the cell object <em>cell</em> to <em>value</em>.  This releases the
 
129
reference to any current content of the cell. <em>value</em> may be <em>NULL</em>.  <em>cell</em>
 
130
must be non-<em>NULL</em>; if it is not a cell object, <code class="docutils literal"><span class="pre">-1</span></code> will be returned.  On
 
131
success, <code class="docutils literal"><span class="pre">0</span></code> will be returned.</p>
 
132
</dd></dl>
 
133
 
 
134
<dl class="function">
 
135
<dt id="c.PyCell_SET">
 
136
void <code class="descname">PyCell_SET</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*cell</em>, <a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*value</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyCell_SET" title="Permalink to this definition">¶</a></dt>
 
137
<dd><p>Sets the value of the cell object <em>cell</em> to <em>value</em>.  No reference counts are
 
138
adjusted, and no checks are made for safety; <em>cell</em> must be non-<em>NULL</em> and must
 
139
be a cell object.</p>
 
140
</dd></dl>
 
141
 
 
142
</div>
 
143
 
 
144
 
 
145
          </div>
 
146
        </div>
 
147
      </div>
 
148
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
 
149
        <div class="sphinxsidebarwrapper">
 
150
  <h4>Previous topic</h4>
 
151
  <p class="topless"><a href="cobject.html"
 
152
                        title="previous chapter">CObjects</a></p>
 
153
  <h4>Next topic</h4>
 
154
  <p class="topless"><a href="gen.html"
 
155
                        title="next chapter">Generator Objects</a></p>
 
156
<h3>This Page</h3>
 
157
<ul class="this-page-menu">
 
158
  <li><a href="../bugs.html">Report a Bug</a></li>
 
159
  <li><a href="../_sources/c-api/cell.txt"
 
160
         rel="nofollow">Show Source</a></li>
 
161
</ul>
 
162
 
 
163
<div id="searchbox" style="display: none" role="search">
 
164
  <h3>Quick search</h3>
 
165
    <form class="search" action="../search.html" method="get">
 
166
      <input type="text" name="q" />
 
167
      <input type="submit" value="Go" />
 
168
      <input type="hidden" name="check_keywords" value="yes" />
 
169
      <input type="hidden" name="area" value="default" />
 
170
    </form>
 
171
    <p class="searchtip" style="font-size: 90%">
 
172
    Enter search terms or a module, class or function name.
 
173
    </p>
 
174
</div>
 
175
<script type="text/javascript">$('#searchbox').show(0);</script>
 
176
        </div>
 
177
      </div>
 
178
      <div class="clearer"></div>
 
179
    </div>  
 
180
    <div class="related" role="navigation" aria-label="related navigation">
 
181
      <h3>Navigation</h3>
 
182
      <ul>
 
183
        <li class="right" style="margin-right: 10px">
 
184
          <a href="../genindex.html" title="General Index"
 
185
             >index</a></li>
 
186
        <li class="right" >
 
187
          <a href="../py-modindex.html" title="Python Module Index"
 
188
             >modules</a> |</li>
 
189
        <li class="right" >
 
190
          <a href="gen.html" title="Generator Objects"
 
191
             >next</a> |</li>
 
192
        <li class="right" >
 
193
          <a href="cobject.html" title="CObjects"
 
194
             >previous</a> |</li>
 
195
        <li><img src="../_static/py.png" alt=""
 
196
                 style="vertical-align: middle; margin-top: -1px"/></li>
 
197
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
 
198
        <li>
 
199
          <span class="version_switcher_placeholder">2.7.12</span>
 
200
          <a href="../index.html">Documentation</a> &raquo;
 
201
        </li>
 
202
 
 
203
          <li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> &raquo;</li>
 
204
          <li class="nav-item nav-item-2"><a href="concrete.html" >Concrete Objects Layer</a> &raquo;</li> 
 
205
      </ul>
 
206
    </div>  
 
207
    <div class="footer">
 
208
    &copy; <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
 
209
    <br />
 
210
    The Python Software Foundation is a non-profit corporation.
 
211
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
 
212
    <br />
 
213
    Last updated on Sep 20, 2016.
 
214
    <a href="../bugs.html">Found a bug</a>?
 
215
    <br />
 
216
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
 
217
    </div>
 
218
 
 
219
  </body>
 
220
</html>
 
 
b'\\ No newline at end of file'