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>Method Objects — Python 2.7.11 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.11 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.11 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>
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="file.html" title="File Objects"
55
accesskey="N">next</a> |</li>
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> »</li>
63
<span class="version_switcher_placeholder">2.7.11</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="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>
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>
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> *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>
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> *func</em>, <a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em> *self</em>, <a class="reference internal" href="structures.html#c.PyObject" title="PyObject">PyObject</a><em> *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>
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> *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>
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> *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>
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> *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>
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> *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>
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> *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>
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> *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>
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>
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>
163
<p class="topless"><a href="file.html"
164
title="next chapter">File Objects</a></p>
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>
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" />
180
<p class="searchtip" style="font-size: 90%">
181
Enter search terms or a module, class or function name.
184
<script type="text/javascript">$('#searchbox').show(0);</script>
187
<div class="clearer"></div>
189
<div class="related" role="navigation" aria-label="related navigation">
192
<li class="right" style="margin-right: 10px">
193
<a href="../genindex.html" title="General Index"
196
<a href="../py-modindex.html" title="Python Module Index"
199
<a href="file.html" title="File Objects"
202
<a href="function.html" title="Function Objects"
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> »</li>
208
<span class="version_switcher_placeholder">2.7.11</span>
209
<a href="../index.html">Documentation</a> »
212
<li class="nav-item nav-item-1"><a href="index.html" >Python/C API Reference Manual</a> »</li>
213
<li class="nav-item nav-item-2"><a href="concrete.html" >Concrete Objects Layer</a> »</li>
217
© <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
219
The Python Software Foundation is a non-profit corporation.
220
<a href="https://www.python.org/psf/donations/">Please donate.</a>
222
Last updated on Jan 23, 2016.
223
<a href="../bugs.html">Found a bug</a>?
225
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
b'\\ No newline at end of file'