summaryrefslogtreecommitdiffstats
path: root/Doc/tut
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1998-04-13 01:31:10 (GMT)
committerFred Drake <fdrake@acm.org>1998-04-13 01:31:10 (GMT)
commit7238988657b3676e115e2528e83722a7d17e36c8 (patch)
tree5ff28a7b0201e97e6fef8eb6faca63b4f0f1fb7c /Doc/tut
parent003d8da7799d88f42655ac7afdf5dc3010f75854 (diff)
downloadcpython-7238988657b3676e115e2528e83722a7d17e36c8.zip
cpython-7238988657b3676e115e2528e83722a7d17e36c8.tar.gz
cpython-7238988657b3676e115e2528e83722a7d17e36c8.tar.bz2
Fixed example to load the startup file from a script (didn't test for the
file's existance). Removed some XXX comments about extension modules which support pickling. Added text from AMK about the readline and rlcompleter modules. Thanks, AMK!
Diffstat (limited to 'Doc/tut')
-rw-r--r--Doc/tut/tut.tex36
1 files changed, 30 insertions, 6 deletions
diff --git a/Doc/tut/tut.tex b/Doc/tut/tut.tex
index 0307970..f8b198d 100644
--- a/Doc/tut/tut.tex
+++ b/Doc/tut/tut.tex
@@ -317,15 +317,18 @@ You can also change the prompts \code{sys.ps1} and \code{sys.ps2} in
this file.
If you want to read an additional start-up file from the current
-directory, you can program this in the global start-up file, e.g.
-\samp{execfile('.pythonrc')}. If you want to use the startup file
-in a script, you must write this explicitly in the script:
+directory, you can program this in the global start-up file,
+e.g.\ \samp{execfile('.pythonrc')}\indexii{.pythonrc.py}{file}. If
+you want to use the startup file in a script, you must do this
+explicitly in the script:
\begin{verbatim}
import os
-execfile(os.environ['PYTHONSTARTUP'])
+if os.path.isfile(os.environ['PYTHONSTARTUP']):
+ execfile(os.environ['PYTHONSTARTUP'])
\end{verbatim}
+
\chapter{An Informal Introduction to Python}
\label{informal}
@@ -2313,8 +2316,7 @@ stored and reused by other programs or by a future invocation of the
same program; the technical term for this is a \dfn{persistent}
object. Because \module{pickle} is so widely used, many authors who
write Python extensions take care to ensure that new data types such
-as matrices, XXX more examples needed XXX, can be properly pickled and
-unpickled.
+as matrices can be properly pickled and unpickled.
@@ -3454,6 +3456,28 @@ TAB: complete
in your \file{\$HOME/.inputrc}. (Of course, this makes it hard to type
indented continuation lines...)
+Automatic completion of variable and module names is optionally
+available. To enable it in the interpreter's interactive mode, add
+the following to your \file{\$HOME/.pythonrc} file:% $ <- bow to font-lock
+\indexii{.pythonrc.py}{file}%
+\refstmodindex{rlcompleter}%
+\refbimodindex{readline}
+
+\begin{verbatim}
+import rlcompleter, readline
+readline.parse_and_bind('tab: complete')
+\end{verbatim}
+
+This binds the TAB key to the completion function, so hitting the TAB
+key twice suggests completions; it looks at Python statement names,
+the current local variables, and the available module names. For
+dotted expressions such as \code{string.a}, it will evaluate the the
+expression up to the final \character{.} and then suggest completions
+from the attributes of the resulting object. Note that this may
+execute application-defined code if an object with a
+\method{__getattr__()} method is part of the expression.
+
+
\section{Commentary}
\label{commentary}