| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="api.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="api.html" title='Python/C API Reference Manual' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="noneObject.html" /> |
| 13 | <link rel="prev" href="fundamental.html" /> |
| 14 | <link rel="parent" href="fundamental.html" /> |
| 15 | <link rel="next" href="noneObject.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>7.1.1 Type Objects </title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="7.1 Fundamental Objects" |
| 25 | href="fundamental.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="7.1 Fundamental Objects" |
| 28 | href="fundamental.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="7.1.2 The None Object" |
| 31 | href="noneObject.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python/C API Reference Manual</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><img src='../icons/blank.png' |
| 38 | border='0' height='32' alt='' width='32' /></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="fundamental.html">7.1 Fundamental Objects</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="fundamental.html">7.1 Fundamental Objects</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="noneObject.html">7.1.2 The None Object</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H2><A NAME="SECTION009110000000000000000"></A><A NAME="typeObjects"></A> |
| 56 | <BR> |
| 57 | 7.1.1 Type Objects |
| 58 | </H2> |
| 59 | |
| 60 | <P> |
| 61 | <a id='l2h-352' xml:id='l2h-352'></a><dl><dt><b><tt class="ctype"><a id='l2h-353' xml:id='l2h-353'>PyTypeObject</a></tt></b></dt> |
| 62 | <dd> |
| 63 | The C structure of the objects used to describe built-in types. |
| 64 | </dl> |
| 65 | |
| 66 | <P> |
| 67 | <dl><dt>PyObject* <b><tt id='l2h-354' xml:id='l2h-354' class="cdata">PyType_Type</tt></b></dt> |
| 68 | <dd> |
| 69 | This is the type object for type objects; it is the same object as |
| 70 | <code>types.TypeType</code> in the Python layer. |
| 71 | <a id='l2h-356' xml:id='l2h-356'></a></dd></dl> |
| 72 | |
| 73 | <P> |
| 74 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>int <b><tt id='l2h-357' xml:id='l2h-357' class="cfunction">PyType_Check</tt></b>(</nobr></td><td>PyObject *<var>o</var>)</td></tr></table></dt> |
| 75 | <dd> |
| 76 | Return true if the object <var>o</var> is a type object, including |
| 77 | instances of types derived from the standard type object. Return |
| 78 | false in all other cases. |
| 79 | </dd></dl> |
| 80 | |
| 81 | <P> |
| 82 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>int <b><tt id='l2h-358' xml:id='l2h-358' class="cfunction">PyType_CheckExact</tt></b>(</nobr></td><td>PyObject *<var>o</var>)</td></tr></table></dt> |
| 83 | <dd> |
| 84 | Return true if the object <var>o</var> is a type object, but not a |
| 85 | subtype of the standard type object. Return false in all other |
| 86 | cases. |
| 87 | |
| 88 | <span class="versionnote">New in version 2.2.</span> |
| 89 | |
| 90 | </dd></dl> |
| 91 | |
| 92 | <P> |
| 93 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>int <b><tt id='l2h-359' xml:id='l2h-359' class="cfunction">PyType_HasFeature</tt></b>(</nobr></td><td>PyObject *<var>o</var>, int <var>feature</var>)</td></tr></table></dt> |
| 94 | <dd> |
| 95 | Return true if the type object <var>o</var> sets the feature |
| 96 | <var>feature</var>. Type features are denoted by single bit flags. |
| 97 | </dd></dl> |
| 98 | |
| 99 | <P> |
| 100 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>int <b><tt id='l2h-360' xml:id='l2h-360' class="cfunction">PyType_IS_GC</tt></b>(</nobr></td><td>PyObject *<var>o</var>)</td></tr></table></dt> |
| 101 | <dd> |
| 102 | Return true if the type object includes support for the cycle |
| 103 | detector; this tests the type flag <tt class="constant">Py_TPFLAGS_HAVE_GC</tt>. |
| 104 | |
| 105 | <span class="versionnote">New in version 2.0.</span> |
| 106 | |
| 107 | </dd></dl> |
| 108 | |
| 109 | <P> |
| 110 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>int <b><tt id='l2h-361' xml:id='l2h-361' class="cfunction">PyType_IsSubtype</tt></b>(</nobr></td><td>PyTypeObject *<var>a</var>, PyTypeObject *<var>b</var>)</td></tr></table></dt> |
| 111 | <dd> |
| 112 | Return true if <var>a</var> is a subtype of <var>b</var>. |
| 113 | |
| 114 | <span class="versionnote">New in version 2.2.</span> |
| 115 | |
| 116 | </dd></dl> |
| 117 | |
| 118 | <P> |
| 119 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>PyObject* <b><tt id='l2h-362' xml:id='l2h-362' class="cfunction">PyType_GenericAlloc</tt></b>(</nobr></td><td>PyTypeObject *<var>type</var>, |
| 120 | int <var>nitems</var>)</td></tr></table></dt> |
| 121 | <dd> |
| 122 | <div class="refcount-info"> |
| 123 | <span class="label">Return value:</span> |
| 124 | <span class="value">New reference.</span> |
| 125 | </div> |
| 126 | |
| 127 | <span class="versionnote">New in version 2.2.</span> |
| 128 | |
| 129 | </dd></dl> |
| 130 | |
| 131 | <P> |
| 132 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>PyObject* <b><tt id='l2h-363' xml:id='l2h-363' class="cfunction">PyType_GenericNew</tt></b>(</nobr></td><td>PyTypeObject *<var>type</var>, |
| 133 | PyObject *<var>args</var>, PyObject *<var>kwds</var>)</td></tr></table></dt> |
| 134 | <dd> |
| 135 | <div class="refcount-info"> |
| 136 | <span class="label">Return value:</span> |
| 137 | <span class="value">New reference.</span> |
| 138 | </div> |
| 139 | |
| 140 | <span class="versionnote">New in version 2.2.</span> |
| 141 | |
| 142 | </dd></dl> |
| 143 | |
| 144 | <P> |
| 145 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>int <b><tt id='l2h-364' xml:id='l2h-364' class="cfunction">PyType_Ready</tt></b>(</nobr></td><td>PyTypeObject *<var>type</var>)</td></tr></table></dt> |
| 146 | <dd> |
| 147 | Finalize a type object. This should be called on all type objects |
| 148 | to finish their initialization. This function is responsible for |
| 149 | adding inherited slots from a type's base class. Return <code>0</code> |
| 150 | on success, or return <code>-1</code> and sets an exception on error. |
| 151 | |
| 152 | <span class="versionnote">New in version 2.2.</span> |
| 153 | |
| 154 | </dd></dl> |
| 155 | |
| 156 | <P> |
| 157 | |
| 158 | <DIV CLASS="navigation"> |
| 159 | <div class='online-navigation'> |
| 160 | <p></p><hr /> |
| 161 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 162 | <tr> |
| 163 | <td class='online-navigation'><a rel="prev" title="7.1 Fundamental Objects" |
| 164 | href="fundamental.html"><img src='../icons/previous.png' |
| 165 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 166 | <td class='online-navigation'><a rel="parent" title="7.1 Fundamental Objects" |
| 167 | href="fundamental.html"><img src='../icons/up.png' |
| 168 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 169 | <td class='online-navigation'><a rel="next" title="7.1.2 The None Object" |
| 170 | href="noneObject.html"><img src='../icons/next.png' |
| 171 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 172 | <td align="center" width="100%">Python/C API Reference Manual</td> |
| 173 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 174 | href="contents.html"><img src='../icons/contents.png' |
| 175 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 176 | <td class='online-navigation'><img src='../icons/blank.png' |
| 177 | border='0' height='32' alt='' width='32' /></td> |
| 178 | <td class='online-navigation'><a rel="index" title="Index" |
| 179 | href="genindex.html"><img src='../icons/index.png' |
| 180 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 181 | </tr></table> |
| 182 | <div class='online-navigation'> |
| 183 | <b class="navlabel">Previous:</b> |
| 184 | <a class="sectref" rel="prev" href="fundamental.html">7.1 Fundamental Objects</A> |
| 185 | <b class="navlabel">Up:</b> |
| 186 | <a class="sectref" rel="parent" href="fundamental.html">7.1 Fundamental Objects</A> |
| 187 | <b class="navlabel">Next:</b> |
| 188 | <a class="sectref" rel="next" href="noneObject.html">7.1.2 The None Object</A> |
| 189 | </div> |
| 190 | </div> |
| 191 | <hr /> |
| 192 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 193 | </DIV> |
| 194 | <!--End of Navigation Panel--> |
| 195 | <ADDRESS> |
| 196 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 197 | </ADDRESS> |
| 198 | </BODY> |
| 199 | </HTML> |