@@ -29,10 +29,10 @@ \section{Standard Module \sectcode{pickle}}
2929
3030\strong {Note:} The \code {pickle} module is rather slow. A
3131reimplementation of the same algorithm in C, which is up to 1000 times
32- faster, is available as the \code {cPickle} module. This has the same
33- interface except that \code {Pickler} and \code {Unpickler} are factory
34- functions, not classes (so they cannot be used as a base class for
35- inheritance).
32+ faster, is available as the \code {cPickle}\refbimodindex {cPickle}
33+ module. This has the same interface except that \code {Pickler} and
34+ \code {Unpickler} are factory functions, not classes (so they cannot be
35+ used as a base class for inheritance).
3636
3737Unlike the built-in module \code {marshal}, \code {pickle} handles the
3838following correctly:
@@ -50,9 +50,12 @@ \section{Standard Module \sectcode{pickle}}
5050
5151The data format used by \code {pickle} is Python-specific. This has
5252the advantage that there are no restrictions imposed by external
53- standards such as CORBA (which probably can't represent pointer
54- sharing or recursive objects); however it means that non-Python
55- programs may not be able to reconstruct pickled Python objects.
53+ standards such as XDR%
54+ \index {XDR}
55+ \index {External Data Representation}
56+ (which can't represent pointer sharing); however
57+ it means that non-Python programs may not be able to reconstruct
58+ pickled Python objects.
5659
5760By default, the \code {pickle} data format uses a printable \ASCII {}
5861representation. This is slightly more voluminous than a binary
@@ -82,8 +85,8 @@ \section{Standard Module \sectcode{pickle}}
8285arbitrary string of printable \ASCII {} characters. The resolution of
8386such names is not defined by the \code {pickle} module --- the
8487persistent object module will have to implement a method
85- \code {persistent_load}. To write references to persistent objects,
86- the persistent module must define a method \code {persistent_id} which
88+ \code {persistent_load() }. To write references to persistent objects,
89+ the persistent module must define a method \code {persistent_id() } which
8790returns either \code {None} or the persistent ID of the object.
8891
8992There are some restrictions on the pickling of class instances.
@@ -93,16 +96,16 @@ \section{Standard Module \sectcode{pickle}}
9396
9497\renewcommand {\indexsubitem }{(pickle protocol)}
9598
96- When a pickled class instance is unpickled, its \code {__init__} method
99+ When a pickled class instance is unpickled, its \code {__init__() } method
97100is normally \emph {not } invoked. \strong {Note:} This is a deviation
98101from previous versions of this module; the change was introduced in
99102Python 1.5b2. The reason for the change is that in many cases it is
100103desirable to have a constructor that requires arguments; it is a
101- (minor) nuisance to have to provide a \code {__getinitargs__} method.
104+ (minor) nuisance to have to provide a \code {__getinitargs__() } method.
102105
103- If it is desirable that the \code {__init__} method be called on
106+ If it is desirable that the \code {__init__() } method be called on
104107unpickling, a class can define a method \code {__getinitargs__()},
105- which should return a { \em tuple} containing the arguments to be
108+ which should return a \emph { tuple } containing the arguments to be
106109passed to the class constructor (\code {__init__()}). This method is
107110called at pickle time; the tuple it returns is incorporated in the
108111pickle for the instance.
@@ -171,9 +174,9 @@ \section{Standard Module \sectcode{pickle}}
171174x = pickle.load(f)
172175\end {verbatim }\ecode
173176%
174- The \code {Pickler} class only calls the method \code {f.write} with a
175- string argument. The \code {Unpickler} calls the methods \code {f.read}
176- (with an integer argument) and \code {f.readline} (without argument),
177+ The \code {Pickler} class only calls the method \code {f.write() } with a
178+ string argument. The \code {Unpickler} calls the methods \code {f.read() }
179+ (with an integer argument) and \code {f.readline() } (without argument),
177180both returning a string. It is explicitly allowed to pass non-file
178181objects here, as long as they have the right methods.
179182\ttindex {Unpickler}
@@ -213,7 +216,7 @@ \section{Standard Module \sectcode{pickle}}
213216same number of calls to the \code {load()} instance of the
214217corresponding \code {Unpickler} instance. If the same object is
215218pickled by multiple \code {dump()} calls, the \code {load()} will all
216- yield references to the same object. { \em Warning}: this is intended
219+ yield references to the same object. \emph { Warning }: this is intended
217220for pickling multiple objects without intervening modifications to the
218221objects or their parts. If you modify an object and then pickle it
219222again using the same \code {Pickler} instance, the object is not
@@ -237,7 +240,7 @@ \section{Standard Module \sectcode{pickle}}
237240
238241\begin {funcdesc }{load}{file}
239242Read a pickled object from the open file object \var {file}. This is
240- equivalent to \code {Unpickler(file).load()}.
243+ equivalent to \code {Unpickler(\var { file} ).load()}.
241244\end {funcdesc }
242245
243246\begin {funcdesc }{dumps}{object\optional {, bin}}
0 commit comments