summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libpickle.tex
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1998-02-13 06:58:54 (GMT)
committerFred Drake <fdrake@acm.org>1998-02-13 06:58:54 (GMT)
commit1947991c2f85db781fb3fcdc9e3bcfe2905e58e2 (patch)
tree260789493c7151408f009eaa84a7815ce4d28246 /Doc/lib/libpickle.tex
parentdc8af0acc1fbeec89e43f1ea43bf1a4d016f4fc6 (diff)
downloadcpython-1947991c2f85db781fb3fcdc9e3bcfe2905e58e2.zip
cpython-1947991c2f85db781fb3fcdc9e3bcfe2905e58e2.tar.gz
cpython-1947991c2f85db781fb3fcdc9e3bcfe2905e58e2.tar.bz2
Remove all \bcode / \ecode cruft; this is no longer needed. See previous
checkin of myformat.sty. Change "\renewcommand{\indexsubitem}{(...)}" to "\setindexsubitem{(...)}" everywhere. Some other minor nits that I happened to come across.
Diffstat (limited to 'Doc/lib/libpickle.tex')
-rw-r--r--Doc/lib/libpickle.tex22
1 files changed, 11 insertions, 11 deletions
diff --git a/Doc/lib/libpickle.tex b/Doc/lib/libpickle.tex
index 5eef11c..41191d4 100644
--- a/Doc/lib/libpickle.tex
+++ b/Doc/lib/libpickle.tex
@@ -8,7 +8,7 @@
\indexii{flattening}{objects}
\indexii{pickling}{objects}
-\renewcommand{\indexsubitem}{(in module pickle)}
+\setindexsubitem{(in module pickle)}
The \code{pickle} module implements a basic but powerful algorithm for
``pickling'' (a.k.a.\ serializing, marshalling or flattening) nearly
@@ -94,7 +94,7 @@ There are some restrictions on the pickling of class instances.
First of all, the class must be defined at the top level in a module.
Furthermore, all its instance variables must be picklable.
-\renewcommand{\indexsubitem}{(pickle protocol)}
+\setindexsubitem{(pickle protocol)}
When a pickled class instance is unpickled, its \code{__init__()} method
is normally \emph{not} invoked. \strong{Note:} This is a deviation
@@ -144,35 +144,35 @@ definition is not pickled, but re-imported by the unpickling process.
Therefore, the restriction that the class must be defined at the top
level in a module applies to pickled classes as well.
-\renewcommand{\indexsubitem}{(in module pickle)}
+\setindexsubitem{(in module pickle)}
The interface can be summarized as follows.
To pickle an object \code{x} onto a file \code{f}, open for writing:
-\bcode\begin{verbatim}
+\begin{verbatim}
p = pickle.Pickler(f)
p.dump(x)
-\end{verbatim}\ecode
+\end{verbatim}
%
A shorthand for this is:
-\bcode\begin{verbatim}
+\begin{verbatim}
pickle.dump(x, f)
-\end{verbatim}\ecode
+\end{verbatim}
%
To unpickle an object \code{x} from a file \code{f}, open for reading:
-\bcode\begin{verbatim}
+\begin{verbatim}
u = pickle.Unpickler(f)
x = u.load()
-\end{verbatim}\ecode
+\end{verbatim}
%
A shorthand is:
-\bcode\begin{verbatim}
+\begin{verbatim}
x = pickle.load(f)
-\end{verbatim}\ecode
+\end{verbatim}
%
The \code{Pickler} class only calls the method \code{f.write()} with a
string argument. The \code{Unpickler} calls the methods \code{f.read()}