summaryrefslogtreecommitdiffstats
path: root/Doc/tutorial
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-08-06 14:58:15 (GMT)
committerÉric Araujo <merwok@netwok.org>2011-08-06 14:58:15 (GMT)
commit7dc76fdeb14e0a2bf1248d78c2439b5a244f8885 (patch)
treec1713816362d4310d28e81f27073cfedb7743429 /Doc/tutorial
parent29f6297605fba9f7313b2aeaf2ddbb06653cfdbb (diff)
parent6ef038e78c0c76e77b2561a154182264b7b9907a (diff)
downloadcpython-7dc76fdeb14e0a2bf1248d78c2439b5a244f8885.zip
cpython-7dc76fdeb14e0a2bf1248d78c2439b5a244f8885.tar.gz
cpython-7dc76fdeb14e0a2bf1248d78c2439b5a244f8885.tar.bz2
Merge doc changes from 3.2 (#8617, #10745).
In the install and library docs, I changed the text to refer to packaging instead of distutils. I also checked that the documented paths correctly reflect what’s really defined in sysconfig; the main difference with paths defined in distutils.install is that include directories don’t end with the distribution name anymore (i.e. distutils uses include/python3.3/spam, sysconfig include/python3.3), I have no idea why.
Diffstat (limited to 'Doc/tutorial')
-rw-r--r--Doc/tutorial/interactive.rst7
-rw-r--r--Doc/tutorial/interpreter.rst24
2 files changed, 27 insertions, 4 deletions
diff --git a/Doc/tutorial/interactive.rst b/Doc/tutorial/interactive.rst
index 5faaf96..36acb06 100644
--- a/Doc/tutorial/interactive.rst
+++ b/Doc/tutorial/interactive.rst
@@ -156,17 +156,18 @@ symbol table. A command to check (or even suggest) matching parentheses,
quotes, etc., would also be useful.
One alternative enhanced interactive interpreter that has been around for quite
-some time is `IPython`_, which features tab completion, object exploration and
+some time is IPython_, which features tab completion, object exploration and
advanced history management. It can also be thoroughly customized and embedded
into other applications. Another similar enhanced interactive environment is
-`bpython`_.
+bpython_.
.. rubric:: Footnotes
.. [#] Python will execute the contents of a file identified by the
:envvar:`PYTHONSTARTUP` environment variable when you start an interactive
- interpreter.
+ interpreter. To customize Python even for non-interactive mode, see
+ :ref:`tut-customize`.
.. _GNU Readline: http://tiswww.case.edu/php/chet/readline/rltop.html
diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst
index 4b83170..4f16c87 100644
--- a/Doc/tutorial/interpreter.rst
+++ b/Doc/tutorial/interpreter.rst
@@ -236,6 +236,29 @@ in the script::
exec(open(filename).read())
+.. _tut-customize:
+
+The Customization Modules
+-------------------------
+
+Python provides two hooks to let you customize it: :mod:`sitecustomize` and
+:mod:`usercustomize`. To see how it works, you need first to find the location
+of your user site-packages directory. Start Python and run this code:
+
+ >>> import site
+ >>> site.getusersitepackages()
+ '/home/user/.local/lib/python3.2/site-packages'
+
+Now you can create a file named :file:`usercustomize.py` in that directory and
+put anything you want in it. It will affect every invocation of Python, unless
+it is started with the :option:`-s` option to disable the automatic import.
+
+:mod:`sitecustomize` works in the same way, but is typically created by an
+administrator of the computer in the global site-packages directory, and is
+imported before :mod:`usercustomize`. See the documentation of the :mod:`site`
+module for more details.
+
+
.. rubric:: Footnotes
.. [#] On Unix, the Python 3.x interpreter is by default not installed with the
@@ -243,4 +266,3 @@ in the script::
simultaneously installed Python 2.x executable.
.. [#] A problem with the GNU Readline package may prevent this.
-