# 3 Python Services

The modules described in this chapter provide a wide range of services related to the Python interpreter and its interaction with its environment. Here's an overview:

sys
  -- Access system specific parameters and functions.

types
  -- Names for all built-in types.

UserDict, UserList
  -- Class wrappers for dictionary and list objects.

operator
  -- All python's standard operators as built-in functions.

traceback
  -- Print or retrieve a stack traceback.

pickle
  -- Convert Python objects to streams of bytes and back.

shelve
  -- Python object persistency.

copy
  -- Shallow and deep copy operations.

marshal
  -- Convert Python objects to streams of bytes and back (with different constraints).

ni
  -- New import (obsolete).

imp
  -- Access the implementation of the `import` statement.

parser
  -- Retrieve and submit parse trees from and to the runtime support environment.

keyword
  -- Test whether a string is a keyword in the Python language.

code
  -- Code object services.

pprint
  -- Data pretty printer.

dis
  -- Disassembler.

site
  -- A standard way to reference site-specific modules.

user
  -- A standard way to reference user-specific modules.

__builtin__
  -- The set of built-in functions.

__main__
  -- The environment where the top-level script is run.

- 3.1 Built-in Module `sys`
- 3.2 Standard Module `types`
- 3.3 Standard Modules `UserDict` and `UserList`
- 3.4 Built-in Module `operator`
- 3.5 Standard Module `traceback`
- 3.6 Standard Module `pickle`
- 3.7 Standard Module `shelve`
- 3.8 Standard Module `copy`
- 3.9 Built-in Module `marshal`
- 3.10 Built-in Module `imp`
  - 3.10.1 Examples
- 3.11 Built-in Module `ni`
- 3.12 Built-in Module `parser`
  - 3.12.1 Creating AST Objects
  - 3.12.2 Converting AST Objects
  - 3.12.3 Queries on AST Objects
  - 3.12.4 Exceptions and Error Handling
  - 3.12.5 AST Objects
  - 3.12.6 Examples
    - Emulation of `compile()`
    - Information Discovery
- 3.13 Standard Module `symbol`
- 3.14 Standard Module `token`
- 3.15 Standard Module `keyword`
- 3.16 Standard Module `code`
- 3.17 Standard Module `pprint`
  - 3.17.1 PrettyPrinter Objects
- 3.18 Standard Module `dis`
  - 3.18.1 Python Byte Code Instructions
- 3.19 Standard Module `site`
- 3.20 Standard Module `user`
- 3.21 Built-in Module `__builtin__`
- 3.22 Built-in Module `__main__`