#
2.2 Built-in Types

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 complete.

The principal built-in types are numerics, sequences, mappings, files classes, instances and exceptions.

Some operations are supported by several object types; in particular, all objects can be compared, tested for truth value, and converted to a string (with the `` ...`` notation). The latter conversion is implicitly used when an object is written by the `print` statement. (Information on `print` statement and other language statements can be found in the Python Reference Manual and the Python Tutorial.)

Subsections

- 2.2.1 Truth Value Testing
- 2.2.2 Boolean Operations
- 2.2.3 Comparisons
- 2.2.4 Numeric Types
  - 2.2.4.1 Bit-string Operations on Integer Types
- 2.2.5 Iterator Types
- 2.2.6 Sequence Types
  - 2.2.6.1 String Methods
  - 2.2.6.2 String Formatting Operations
  - 2.2.6.3 XRange Type
  - 2.2.6.4 Mutable Sequence Types
- 2.2.7 Mapping Types
- 2.2.8 File Objects
- 2.2.9 Other Built-in Types
  - 2.2.9.1 Modules
  - 2.2.9.2 Classes and Class Instances
  - 2.2.9.3 Functions
  - 2.2.9.4 Methods
  - 2.2.9.5 Code Objects
  - 2.2.9.6 Type Objects
  - 2.2.9.7 The Null Object
  - 2.2.9.8 The Ellipsis Object
  - 2.2.9.9 Boolean Values
  - 2.2.9.10 Internal Objects
- 2.2.10 Special Attributes