| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.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="lib.html" title='Python Library Reference' /> |
| 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="module-exceptions.html" /> |
| 13 | <link rel="prev" href="non-essential-built-in-funcs.html" /> |
| 14 | <link rel="parent" href="builtin.html" /> |
| 15 | <link rel="next" href="truth.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>2.3 Built-in Types </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="2.2 Non-essential Built-in Functions" |
| 25 | href="non-essential-built-in-funcs.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="2. Built-In Objects" |
| 28 | href="builtin.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="2.3.1 Truth Value Testing" |
| 31 | href="truth.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 Library Reference</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'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></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="non-essential-built-in-funcs.html">2.2 Non-essential Built-in Functions</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="builtin.html">2. Built-In Objects</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="truth.html">2.3.1 Truth Value Testing</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H1><A NAME="SECTION004300000000000000000"></A><A NAME="types"></A> |
| 56 | <BR> |
| 57 | 2.3 Built-in Types |
| 58 | </H1> |
| 59 | |
| 60 | <P> |
| 61 | The following sections describe the standard types that are built into |
| 62 | the interpreter. Historically, Python's built-in types have differed |
| 63 | from user-defined types because it was not possible to use the built-in |
| 64 | types as the basis for object-oriented inheritance. With the 2.2 |
| 65 | release this situation has started to change, although the intended |
| 66 | unification of user-defined and built-in types is as yet far from |
| 67 | complete. |
| 68 | |
| 69 | <P> |
| 70 | The principal built-in types are numerics, sequences, mappings, files |
| 71 | classes, instances and exceptions. |
| 72 | <a id='l2h-89' xml:id='l2h-89'></a> |
| 73 | <P> |
| 74 | Some operations are supported by several object types; in particular, |
| 75 | practically all objects can be compared, tested for truth value, |
| 76 | and converted to a string (with the <code>` ...`</code> notation, |
| 77 | the equivalent <tt class="function">repr()</tt> function, or the slightly different |
| 78 | <tt class="function">str()</tt> function). The latter |
| 79 | function is implicitly used when an object is written by the |
| 80 | <tt class="keyword">print</tt><a id='l2h-90' xml:id='l2h-90'></a> statement. |
| 81 | (Information on <a class="ulink" href="../ref/print.html" |
| 82 | ><tt class="keyword">print</tt> statement</a> |
| 83 | and other language statements can be found in the |
| 84 | <em class="citetitle"><a |
| 85 | href="../ref/ref.html" |
| 86 | title="Python Reference Manual" |
| 87 | >Python Reference Manual</a></em> and the |
| 88 | <em class="citetitle"><a |
| 89 | href="../tut/tut.html" |
| 90 | title="Python Tutorial" |
| 91 | >Python Tutorial</a></em>.) |
| 92 | |
| 93 | <P> |
| 94 | |
| 95 | <p><br /></p><hr class='online-navigation' /> |
| 96 | <div class='online-navigation'> |
| 97 | <!--Table of Child-Links--> |
| 98 | <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> |
| 99 | |
| 100 | <UL CLASS="ChildLinks"> |
| 101 | <LI><A href="truth.html">2.3.1 Truth Value Testing</a> |
| 102 | <LI><A href="boolean.html">2.3.2 Boolean Operations -- |
| 103 | <tt class="keyword">and</tt>, <tt class="keyword">or</tt>, <tt class="keyword">not</tt></a> |
| 104 | <LI><A href="comparisons.html">2.3.3 Comparisons</a> |
| 105 | <LI><A href="typesnumeric.html">2.3.4 Numeric Types -- |
| 106 | <tt class="class">int</tt>, <tt class="class">float</tt>, <tt class="class">long</tt>, <tt class="class">complex</tt></a> |
| 107 | <UL> |
| 108 | <LI><A href="bitstring-ops.html">2.3.4.1 Bit-string Operations on Integer Types</a> |
| 109 | </ul> |
| 110 | <LI><A href="typeiter.html">2.3.5 Iterator Types</a> |
| 111 | <LI><A href="typesseq.html">2.3.6 Sequence Types -- |
| 112 | <tt class="class">str</tt>, <tt class="class">unicode</tt>, <tt class="class">list</tt>, |
| 113 | <tt class="class">tuple</tt>, <tt class="class">buffer</tt>, <tt class="class">xrange</tt></a> |
| 114 | <UL> |
| 115 | <LI><A href="string-methods.html">2.3.6.1 String Methods</a> |
| 116 | <LI><A href="typesseq-strings.html">2.3.6.2 String Formatting Operations</a> |
| 117 | <LI><A href="typesseq-xrange.html">2.3.6.3 XRange Type</a> |
| 118 | <LI><A href="typesseq-mutable.html">2.3.6.4 Mutable Sequence Types</a> |
| 119 | </ul> |
| 120 | <LI><A href="types-set.html">2.3.7 Set Types -- |
| 121 | <tt class="class">set</tt>, <tt class="class">frozenset</tt></a> |
| 122 | <LI><A href="typesmapping.html">2.3.8 Mapping Types -- classdict</a> |
| 123 | <LI><A href="bltin-file-objects.html">2.3.9 File Objects</a> |
| 124 | <LI><A href="typesother.html">2.3.10 Other Built-in Types</a> |
| 125 | <UL> |
| 126 | <LI><A href="typesmodules.html">2.3.10.1 Modules</a> |
| 127 | <LI><A href="typesobjects.html">2.3.10.2 Classes and Class Instances</a> |
| 128 | <LI><A href="typesfunctions.html">2.3.10.3 Functions</a> |
| 129 | <LI><A href="typesmethods.html">2.3.10.4 Methods</a> |
| 130 | <LI><A href="bltin-code-objects.html">2.3.10.5 Code Objects</a> |
| 131 | <LI><A href="bltin-type-objects.html">2.3.10.6 Type Objects</a> |
| 132 | <LI><A href="bltin-null-object.html">2.3.10.7 The Null Object</a> |
| 133 | <LI><A href="bltin-ellipsis-object.html">2.3.10.8 The Ellipsis Object</a> |
| 134 | <LI><A href="node31.html">2.3.10.9 Boolean Values</a> |
| 135 | <LI><A href="typesinternal.html">2.3.10.10 Internal Objects</a> |
| 136 | </ul> |
| 137 | <LI><A href="specialattrs.html">2.3.11 Special Attributes</a> |
| 138 | </ul> |
| 139 | <!--End of Table of Child-Links--> |
| 140 | </div> |
| 141 | |
| 142 | <DIV CLASS="navigation"> |
| 143 | <div class='online-navigation'> |
| 144 | <p></p><hr /> |
| 145 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 146 | <tr> |
| 147 | <td class='online-navigation'><a rel="prev" title="2.2 Non-essential Built-in Functions" |
| 148 | href="non-essential-built-in-funcs.html"><img src='../icons/previous.png' |
| 149 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 150 | <td class='online-navigation'><a rel="parent" title="2. Built-In Objects" |
| 151 | href="builtin.html"><img src='../icons/up.png' |
| 152 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 153 | <td class='online-navigation'><a rel="next" title="2.3.1 Truth Value Testing" |
| 154 | href="truth.html"><img src='../icons/next.png' |
| 155 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 156 | <td align="center" width="100%">Python Library Reference</td> |
| 157 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 158 | href="contents.html"><img src='../icons/contents.png' |
| 159 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 160 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 161 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 162 | <td class='online-navigation'><a rel="index" title="Index" |
| 163 | href="genindex.html"><img src='../icons/index.png' |
| 164 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 165 | </tr></table> |
| 166 | <div class='online-navigation'> |
| 167 | <b class="navlabel">Previous:</b> |
| 168 | <a class="sectref" rel="prev" href="non-essential-built-in-funcs.html">2.2 Non-essential Built-in Functions</A> |
| 169 | <b class="navlabel">Up:</b> |
| 170 | <a class="sectref" rel="parent" href="builtin.html">2. Built-In Objects</A> |
| 171 | <b class="navlabel">Next:</b> |
| 172 | <a class="sectref" rel="next" href="truth.html">2.3.1 Truth Value Testing</A> |
| 173 | </div> |
| 174 | </div> |
| 175 | <hr /> |
| 176 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 177 | </DIV> |
| 178 | <!--End of Navigation Panel--> |
| 179 | <ADDRESS> |
| 180 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 181 | </ADDRESS> |
| 182 | </BODY> |
| 183 | </HTML> |