3. Built-in Types
The following sections describe the standard types that are built into
the interpreter.
Note:
Historically (until release 2.2), 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.
This limitation does not exist any longer.
The principal built-in types are numerics, sequences, mappings, files,
classes, instances and exceptions.
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 repr() function or the slightly different
str() function). The latter
function is implicitly used when an object is written by the
print statement.
(Information on the print statement
and other language statements can be found in the
Python Reference Manual and the
Python Tutorial.)
Subsections
- 3.1 Truth Value Testing
- 3.2 Boolean Operations --
and, or, not
- 3.3 Comparisons
- 3.4 Numeric Types --
int, float, long, complex
- 3.5 Iterator Types
- 3.6 Sequence Types --
str, unicode, list,
tuple, buffer, xrange
- 3.7 Set Types --
set, frozenset
- 3.8 Mapping Types -- dict
- 3.9 File Objects
- 3.10 Context Manager Types
- 3.11 Other Built-in Types
- 3.12 Special Attributes
Release 2.5.2, documentation updated on 21st February, 2008.
See About this document... for information on suggesting changes.
|