The following example extends the :class:`code.InteractiveConsole` class to

+This code is actually automatically run when Python is run in

+from the user's :envvar:`PYTHONSTARTUP` file. ::

+below would normally be executed automatically during interactive sessions

+file named :file:`.python_history` from the user's home directory. The code

-normally be executed automatically during interactive sessions from the user's

-file named :file:`.pyhist` from the user's home directory. The code below would

history reading and writing functions to automatically load and save a history

The following example demonstrates how to use the :mod:`readline` module's

this module can still be used for custom purposes.

On platforms without :mod:`readline`, the :class:`Completer` class defined by

+:option:`-S` option, the module is automatically imported and configured

+:ref:`interactive mode <tut-interactive>`. Unless Python is run with the

+The :mod:`rlcompleter` module is designed for use with Python's

- print("Module readline not available.")

-(identified by the :envvar:`PYTHONSTARTUP` environment variable) to get

-mode. A user can add the following lines to his or her initialization file

-The :mod:`rlcompleter` module is designed for use with Python's interactive

This function used to be called unconditionnally.

+ unless the Python interpreter was started with the :option:`-S` flag.

- unless the :program:`python` interpreter was started with the :option:`-S`

path. This function is called automatically when this module is imported,

Adds all the standard site-specific directories to the module search

@@ -153,8 +170,7 @@ empty, and the path manipulations are sk

A list of prefixes for site-packages directories.

+or :mod:`usercustomize` module or your :envvar:`PYTHONSTARTUP` file.

+the :data:`sys.__interactivehook__` attribute in your :mod:`sitecustomize`

+:file:`~/.python_history` as the history save file. To disable it, override

+The default behavior is enable tab-completion and to use

+:ref:`interactive mode <tut-interactive>` and without the :option:`-S` option.

+configure the :mod:`rlcompleter` module, if Python is started in

+On systems that support :mod:`readline`, this module will also import and

:mod:`sitecustomize` and :mod:`usercustomize` is still attempted.

@@ -111,6 +111,23 @@ empty, and the path manipulations are sk

Enter *string* in the table of "interned" strings and return the interned string

+ can set this hook there.

+ This is done after the :envvar:`PYTHONSTARTUP` file is read, so that you

+ when the interpreter is launched in :ref:`interactive mode <tut-interactive>`.

+ When present, this function is automatically called (with no arguments)

@@ -679,6 +679,16 @@ always available.