whatsnew: sys.__interactivehook__. (#5845)

I decided to leave the (slightly expanded) Other Improvements
entry as well, since someone looking for command line behavior
changes isn't going to look in the 'sys' module section.
This commit is contained in:
R David Murray 2014-03-09 12:03:30 -04:00
parent 04ea3f35bd
commit 4e40cec924
3 changed files with 28 additions and 8 deletions

View file

@ -123,9 +123,13 @@ On systems that support :mod:`readline`, this module will also import and
configure the :mod:`rlcompleter` module, if Python is started in
:ref:`interactive mode <tut-interactive>` and without the :option:`-S` option.
The default behavior is enable tab-completion and to use
:file:`~/.python_history` as the history save file. To disable it, override
the :data:`sys.__interactivehook__` attribute in your :mod:`sitecustomize`
or :mod:`usercustomize` module or your :envvar:`PYTHONSTARTUP` file.
:file:`~/.python_history` as the history save file. To disable it, delete (or
override) the :data:`sys.__interactivehook__` attribute in your
:mod:`sitecustomize` or :mod:`usercustomize` module or your
:envvar:`PYTHONSTARTUP` file.
.. versionchanged:: 3.4
Activation of rlcompleter and history was made automatic.
Module contents

View file

@ -692,10 +692,11 @@ always available.
.. data:: __interactivehook__
When present, this function is automatically called (with no arguments)
when the interpreter is launched in :ref:`interactive mode <tut-interactive>`.
This is done after the :envvar:`PYTHONSTARTUP` file is read, so that you
can set this hook there.
When this attribute exists, its value is automatically called (with no
arguments) when the interpreter is launched in :ref:`interactive mode
<tut-interactive>`. This is done after the :envvar:`PYTHONSTARTUP` file is
read, so that you can set this hook there. The :mod:`site` module
:ref:`sets this <rlcompleter-config>`.
.. versionadded:: 3.4