summaryrefslogtreecommitdiffstats
path: root/Doc/lib/liblinecache.tex
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1999-06-14 19:47:47 (GMT)
committerFred Drake <fdrake@acm.org>1999-06-14 19:47:47 (GMT)
commit21572fdcb60a6ab033a2dff66f871389ca1a89c1 (patch)
tree87e11d0cd3aecf1717d37d8a6affedfbb2616a37 /Doc/lib/liblinecache.tex
parentd5258681e7838d8c0e16b9b3448ce4105340ea79 (diff)
downloadcpython-21572fdcb60a6ab033a2dff66f871389ca1a89c1.zip
cpython-21572fdcb60a6ab033a2dff66f871389ca1a89c1.tar.gz
cpython-21572fdcb60a6ab033a2dff66f871389ca1a89c1.tar.bz2
New sections from Moshe Zadka <moshez@math.huji.ac.il>.
These document CGIHTTPServer, SimpleHTTPServer, and linecache.
Diffstat (limited to 'Doc/lib/liblinecache.tex')
-rw-r--r--Doc/lib/liblinecache.tex41
1 files changed, 41 insertions, 0 deletions
diff --git a/Doc/lib/liblinecache.tex b/Doc/lib/liblinecache.tex
new file mode 100644
index 0000000..868ec6d
--- /dev/null
+++ b/Doc/lib/liblinecache.tex
@@ -0,0 +1,41 @@
+\section{\module{linecache} ---
+ Treat files like lists of lines}
+
+\declaremodule{standard}{linecache}
+\sectionauthor{Moshe Zadka}{mzadka@geocities.com}
+\modulesynopsis{This module treats files like random-access lists of lines.}
+
+
+The \module{linecache} module allows one to get any line from any file,
+while attempting to optimize internally, using a cache, the common case
+where many lines are read from a file.
+
+The \module{linecache} module defines the following functions:
+
+\begin{funcdesc}{getline}{filename, lineno}
+Get line \var{lineno} from file named \var{filename}. This function
+will never throw an exception --- it will return \code{''} on errors.
+
+If a file named \var{filename} is not found, the function will look
+for it in the module search path.
+\end{funcdesc}
+
+\begin{funcdesc}{clearcache}{}
+Clear the cache. You might want to use this function if you know that
+you do not need to read lines from many of files you already read from
+using this module.
+\end{funcdesc}
+
+\begin{funcdesc}{checkcache}{}
+Check the cache is still valid. You might want to use this function if
+you suspect that files you read from using this module might have
+changed.
+\end{funcdesc}
+
+Example:
+
+\begin{verbatim}
+>>> import linecache
+>>> linecache.getline('/etc/passwd', 4)
+'sys:x:3:3:sys:/dev:/bin/sh\012'
+\end{verbatim}