<!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
<link rel=
"STYLESHEET" href=
"lib.css" type='text/css'
/>
<link rel=
"SHORTCUT ICON" href=
"../icons/pyfav.png" type=
"image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index'
/>
<link rel=
"first" href=
"lib.html" title='Python Library Reference'
/>
<link rel='contents' href='contents.html'
title=
"Contents" />
<link rel='index' href='genindex.html' title='Index'
/>
<link rel='last' href='about.html' title='About this document...'
/>
<link rel='help' href='about.html' title='About this document...'
/>
<link rel=
"next" href=
"module-exceptions.html" />
<link rel=
"prev" href=
"non-essential-built-in-funcs.html" />
<link rel=
"parent" href=
"builtin.html" />
<link rel=
"next" href=
"truth.html" />
<meta name='aesop' content='information'
/>
<title>2.3 Built-in Types
</title>
<div id='top-navigation-panel' xml:id='top-navigation-panel'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"2.2 Non-essential Built-in Functions"
href=
"non-essential-built-in-funcs.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"2. Built-In Objects"
href=
"builtin.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"2.3.1 Truth Value Testing"
href=
"truth.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Python Library Reference
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"non-essential-built-in-funcs.html">2.2 Non-essential Built-in Functions
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"builtin.html">2. Built-In Objects
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"truth.html">2.3.1 Truth Value Testing
</A>
<!--End of Navigation Panel-->
<H1><A NAME=
"SECTION004300000000000000000"></A><A NAME=
"types"></A>
The following sections describe the standard types that are built into
the interpreter. Historically, Python's built-in types have differed
from user-defined types because it was not possible to use the built-in
types as the basis for object-oriented inheritance. With the
2.2
release this situation has started to change, although the intended
unification of user-defined and built-in types is as yet far from
The principal built-in types are numerics, sequences, mappings, files
classes, instances and exceptions.
<a id='l2h-
89' xml:id='l2h-
89'
></a>
Some operations are supported by several object types; in particular,
practically all objects can be compared, tested for truth value,
and converted to a string (with the
<code>` ...`
</code> notation,
the equivalent
<tt class=
"function">repr()
</tt> function, or the slightly different
<tt class=
"function">str()
</tt> function). The latter
function is implicitly used when an object is written by the
<tt class=
"keyword">print
</tt><a id='l2h-
90' xml:id='l2h-
90'
></a> statement.
(Information on
<a class=
"ulink" href=
"../ref/print.html"
><tt class=
"keyword">print
</tt> statement
</a>
and other language statements can be found in the
title=
"Python Reference Manual"
>Python Reference Manual
</a></em> and the
>Python Tutorial
</a></em>.)
<p><br /></p><hr class='online-navigation'
/>
<div class='online-navigation'
>
<!--Table of Child-Links-->
<A NAME=
"CHILD_LINKS"><STRONG>Subsections
</STRONG></a>
<LI><A href=
"truth.html">2.3.1 Truth Value Testing
</a>
<LI><A href=
"boolean.html">2.3.2 Boolean Operations --
<tt class=
"keyword">and
</tt>,
<tt class=
"keyword">or
</tt>,
<tt class=
"keyword">not
</tt></a>
<LI><A href=
"comparisons.html">2.3.3 Comparisons
</a>
<LI><A href=
"typesnumeric.html">2.3.4 Numeric Types --
<tt class=
"class">int
</tt>,
<tt class=
"class">float
</tt>,
<tt class=
"class">long
</tt>,
<tt class=
"class">complex
</tt></a>
<LI><A href=
"bitstring-ops.html">2.3.4.1 Bit-string Operations on Integer Types
</a>
<LI><A href=
"typeiter.html">2.3.5 Iterator Types
</a>
<LI><A href=
"typesseq.html">2.3.6 Sequence Types --
<tt class=
"class">str
</tt>,
<tt class=
"class">unicode
</tt>,
<tt class=
"class">list
</tt>,
<tt class=
"class">tuple
</tt>,
<tt class=
"class">buffer
</tt>,
<tt class=
"class">xrange
</tt></a>
<LI><A href=
"string-methods.html">2.3.6.1 String Methods
</a>
<LI><A href=
"typesseq-strings.html">2.3.6.2 String Formatting Operations
</a>
<LI><A href=
"typesseq-xrange.html">2.3.6.3 XRange Type
</a>
<LI><A href=
"typesseq-mutable.html">2.3.6.4 Mutable Sequence Types
</a>
<LI><A href=
"types-set.html">2.3.7 Set Types --
<tt class=
"class">set
</tt>,
<tt class=
"class">frozenset
</tt></a>
<LI><A href=
"typesmapping.html">2.3.8 Mapping Types -- classdict
</a>
<LI><A href=
"bltin-file-objects.html">2.3.9 File Objects
</a>
<LI><A href=
"typesother.html">2.3.10 Other Built-in Types
</a>
<LI><A href=
"typesmodules.html">2.3.10.1 Modules
</a>
<LI><A href=
"typesobjects.html">2.3.10.2 Classes and Class Instances
</a>
<LI><A href=
"typesfunctions.html">2.3.10.3 Functions
</a>
<LI><A href=
"typesmethods.html">2.3.10.4 Methods
</a>
<LI><A href=
"bltin-code-objects.html">2.3.10.5 Code Objects
</a>
<LI><A href=
"bltin-type-objects.html">2.3.10.6 Type Objects
</a>
<LI><A href=
"bltin-null-object.html">2.3.10.7 The Null Object
</a>
<LI><A href=
"bltin-ellipsis-object.html">2.3.10.8 The Ellipsis Object
</a>
<LI><A href=
"node31.html">2.3.10.9 Boolean Values
</a>
<LI><A href=
"typesinternal.html">2.3.10.10 Internal Objects
</a>
<LI><A href=
"specialattrs.html">2.3.11 Special Attributes
</a>
<!--End of Table of Child-Links-->
<div class='online-navigation'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"2.2 Non-essential Built-in Functions"
href=
"non-essential-built-in-funcs.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"2. Built-In Objects"
href=
"builtin.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"2.3.1 Truth Value Testing"
href=
"truth.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Python Library Reference
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"non-essential-built-in-funcs.html">2.2 Non-essential Built-in Functions
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"builtin.html">2. Built-In Objects
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"truth.html">2.3.1 Truth Value Testing
</A>
<span class=
"release-info">Release
2.4.2, documentation updated on
28 September
2005.
</span>
<!--End of Navigation Panel-->
See
<i><a href=
"about.html">About this document...
</a></i> for information on suggesting changes.