~dkuhlman/python-training-materials/Materials

« back to all changes in this revision

Viewing changes to python-2.7.12-docs-html/c-api/method.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>Method 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="File Objects" href="file.html" />
 
35
    <link rel="prev" title="Function Objects" href="function.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="file.html" title="File Objects"
 
55
             accesskey="N">next</a> |</li>
 
56
        <li class="right" >
 
57
          <a href="function.html" title="Function 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> &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="method-objects">
 
78
<span id="id1"></span><h1>Method Objects<a class="headerlink" href="#method-objects" title="Permalink to this headline">¶</a></h1>
 
79
<p id="index-0">There are some useful functions that are useful for working with method objects.</p>
 
80
<dl class="var">
 
81
<dt id="c.PyMethod_Type">
 
82
<a class="reference internal" href="type.html#c.PyTypeObject" title="PyTypeObject">PyTypeObject</a> <code class="descname">PyMethod_Type</code><a class="headerlink" href="#c.PyMethod_Type" title="Permalink to this definition">¶</a></dt>
 
83
<dd><p id="index-1">This instance of <a class="reference internal" href="type.html#c.PyTypeObject" title="PyTypeObject"><code class="xref c c-type docutils literal"><span class="pre">PyTypeObject</span></code></a> represents the Python method type.  This
 
84
is exposed to Python programs as <code class="docutils literal"><span class="pre">types.MethodType</span></code>.</p>
 
85
</dd></dl>
 
86
 
 
87
<dl class="function">
 
88
<dt id="c.PyMethod_Check">
 
89
int <code class="descname">PyMethod_Check</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*o</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyMethod_Check" title="Permalink to this definition">¶</a></dt>
 
90
<dd><p>Return true if <em>o</em> is a method object (has type <a class="reference internal" href="#c.PyMethod_Type" title="PyMethod_Type"><code class="xref c c-data docutils literal"><span class="pre">PyMethod_Type</span></code></a>).  The
 
91
parameter must not be <em>NULL</em>.</p>
 
92
</dd></dl>
 
93
 
 
94
<dl class="function">
 
95
<dt id="c.PyMethod_New">
 
96
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a>* <code class="descname">PyMethod_New</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*func</em>, <a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*self</em>, <a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*class</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyMethod_New" title="Permalink to this definition">¶</a></dt>
 
97
<dd><em class="refcount">Return value: New reference.</em><p>Return a new method object, with <em>func</em> being any callable object; this is the
 
98
function that will be called when the method is called.  If this method should
 
99
be bound to an instance, <em>self</em> should be the instance and <em>class</em> should be the
 
100
class of <em>self</em>, otherwise <em>self</em> should be <em>NULL</em> and <em>class</em> should be the
 
101
class which provides the unbound method..</p>
 
102
</dd></dl>
 
103
 
 
104
<dl class="function">
 
105
<dt id="c.PyMethod_Class">
 
106
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a>* <code class="descname">PyMethod_Class</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*meth</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyMethod_Class" title="Permalink to this definition">¶</a></dt>
 
107
<dd><em class="refcount">Return value: Borrowed reference.</em><p>Return the class object from which the method <em>meth</em> was created; if this was
 
108
created from an instance, it will be the class of the instance.</p>
 
109
</dd></dl>
 
110
 
 
111
<dl class="function">
 
112
<dt id="c.PyMethod_GET_CLASS">
 
113
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a>* <code class="descname">PyMethod_GET_CLASS</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*meth</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyMethod_GET_CLASS" title="Permalink to this definition">¶</a></dt>
 
114
<dd><em class="refcount">Return value: Borrowed reference.</em><p>Macro version of <a class="reference internal" href="#c.PyMethod_Class" title="PyMethod_Class"><code class="xref c c-func docutils literal"><span class="pre">PyMethod_Class()</span></code></a> which avoids error checking.</p>
 
115
</dd></dl>
 
116
 
 
117
<dl class="function">
 
118
<dt id="c.PyMethod_Function">
 
119
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a>* <code class="descname">PyMethod_Function</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*meth</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyMethod_Function" title="Permalink to this definition">¶</a></dt>
 
120
<dd><em class="refcount">Return value: Borrowed reference.</em><p>Return the function object associated with the method <em>meth</em>.</p>
 
121
</dd></dl>
 
122
 
 
123
<dl class="function">
 
124
<dt id="c.PyMethod_GET_FUNCTION">
 
125
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a>* <code class="descname">PyMethod_GET_FUNCTION</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*meth</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyMethod_GET_FUNCTION" title="Permalink to this definition">¶</a></dt>
 
126
<dd><em class="refcount">Return value: Borrowed reference.</em><p>Macro version of <a class="reference internal" href="#c.PyMethod_Function" title="PyMethod_Function"><code class="xref c c-func docutils literal"><span class="pre">PyMethod_Function()</span></code></a> which avoids error checking.</p>
 
127
</dd></dl>
 
128
 
 
129
<dl class="function">
 
130
<dt id="c.PyMethod_Self">
 
131
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a>* <code class="descname">PyMethod_Self</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*meth</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyMethod_Self" title="Permalink to this definition">¶</a></dt>
 
132
<dd><em class="refcount">Return value: Borrowed reference.</em><p>Return the instance associated with the method <em>meth</em> if it is bound, otherwise
 
133
return <em>NULL</em>.</p>
 
134
</dd></dl>
 
135
 
 
136
<dl class="function">
 
137
<dt id="c.PyMethod_GET_SELF">
 
138
<a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a>* <code class="descname">PyMethod_GET_SELF</code><span class="sig-paren">(</span><a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em>&nbsp;*meth</em><span class="sig-paren">)</span><a class="headerlink" href="#c.PyMethod_GET_SELF" title="Permalink to this definition">¶</a></dt>
 
139
<dd><em class="refcount">Return value: Borrowed reference.</em><p>Macro version of <a class="reference internal" href="#c.PyMethod_Self" title="PyMethod_Self"><code class="xref c c-func docutils literal"><span class="pre">PyMethod_Self()</span></code></a> which avoids error checking.</p>
 
140
</dd></dl>
 
141
 
 
142
<dl class="function">
 
143
<dt id="c.PyMethod_ClearFreeList">
 
144
int <code class="descname">PyMethod_ClearFreeList</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#c.PyMethod_ClearFreeList" title="Permalink to this definition">¶</a></dt>
 
145
<dd><p>Clear the free list. Return the total number of freed items.</p>
 
146
<div class="versionadded">
 
147
<p><span class="versionmodified">New in version 2.6.</span></p>
 
148
</div>
 
149
</dd></dl>
 
150
 
 
151
</div>
 
152
 
 
153
 
 
154
          </div>
 
155
        </div>
 
156
      </div>
 
157
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
 
158
        <div class="sphinxsidebarwrapper">
 
159
  <h4>Previous topic</h4>
 
160
  <p class="topless"><a href="function.html"
 
161
                        title="previous chapter">Function Objects</a></p>
 
162
  <h4>Next topic</h4>
 
163
  <p class="topless"><a href="file.html"
 
164
                        title="next chapter">File Objects</a></p>
 
165
<h3>This Page</h3>
 
166
<ul class="this-page-menu">
 
167
  <li><a href="../bugs.html">Report a Bug</a></li>
 
168
  <li><a href="../_sources/c-api/method.txt"
 
169
         rel="nofollow">Show Source</a></li>
 
170
</ul>
 
171
 
 
172
<div id="searchbox" style="display: none" role="search">
 
173
  <h3>Quick search</h3>
 
174
    <form class="search" action="../search.html" method="get">
 
175
      <input type="text" name="q" />
 
176
      <input type="submit" value="Go" />
 
177
      <input type="hidden" name="check_keywords" value="yes" />
 
178
      <input type="hidden" name="area" value="default" />
 
179
    </form>
 
180
    <p class="searchtip" style="font-size: 90%">
 
181
    Enter search terms or a module, class or function name.
 
182
    </p>
 
183
</div>
 
184
<script type="text/javascript">$('#searchbox').show(0);</script>
 
185
        </div>
 
186
      </div>
 
187
      <div class="clearer"></div>
 
188
    </div>  
 
189
    <div class="related" role="navigation" aria-label="related navigation">
 
190
      <h3>Navigation</h3>
 
191
      <ul>
 
192
        <li class="right" style="margin-right: 10px">
 
193
          <a href="../genindex.html" title="General Index"
 
194
             >index</a></li>
 
195
        <li class="right" >
 
196
          <a href="../py-modindex.html" title="Python Module Index"
 
197
             >modules</a> |</li>
 
198
        <li class="right" >
 
199
          <a href="file.html" title="File Objects"
 
200
             >next</a> |</li>
 
201
        <li class="right" >
 
202
          <a href="function.html" title="Function Objects"
 
203
             >previous</a> |</li>
 
204
        <li><img src="../_static/py.png" alt=""
 
205
                 style="vertical-align: middle; margin-top: -1px"/></li>
 
206
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
 
207
        <li>
 
208
          <span class="version_switcher_placeholder">2.7.12</span>
 
209
          <a href="../index.html">Documentation</a> &raquo;
 
210
        </li>
 
211
 
 
212
          <li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> &raquo;</li>
 
213
          <li class="nav-item nav-item-2"><a href="concrete.html" >Concrete Objects Layer</a> &raquo;</li> 
 
214
      </ul>
 
215
    </div>  
 
216
    <div class="footer">
 
217
    &copy; <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
 
218
    <br />
 
219
    The Python Software Foundation is a non-profit corporation.
 
220
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
 
221
    <br />
 
222
    Last updated on Sep 20, 2016.
 
223
    <a href="../bugs.html">Found a bug</a>?
 
224
    <br />
 
225
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
 
226
    </div>
 
227
 
 
228
  </body>
 
229
</html>
 
 
b'\\ No newline at end of file'