Built-in Types

Approximately two dozen types are built into the Python interpreter and grouped into a few major categories, as shown in Table 3.1. Some categories include familiar objects such as numbers and sequences. Others are used during program execution and are of little practical use to most programmers. The next few sections describe the most commonly used built-in types.

Table 3.1. Built-in Python Types
Type Category Type Name Description
None NoneType The null object
Numbers IntType

LongType

FloatType

ComplexType
Integer

Arbitrary-precision integer

Floating-point number

Complex number
Sequences StringType

UnicodeType

ListType

TupleType

XRangeType

BufferType
Character string

Unicode character string

List

Tuple

Returned by xrange()

Get Python Essential Reference, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.