diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2003-02-21 00:26:33 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2003-02-21 00:26:33 (GMT) |
commit | d08baa95042c349a7129e1857678a74446b9b232 (patch) | |
tree | 857854e49809fc93163edee3b2b0ff3852089987 /Doc/lib | |
parent | 850566b644142f8698d691782e7ef3fa8d7a6cf8 (diff) | |
download | cpython-d08baa95042c349a7129e1857678a74446b9b232.zip cpython-d08baa95042c349a7129e1857678a74446b9b232.tar.gz cpython-d08baa95042c349a7129e1857678a74446b9b232.tar.bz2 |
Add some notes about HIGHEST_PROTOCOL.
Diffstat (limited to 'Doc/lib')
-rw-r--r-- | Doc/lib/libpickle.tex | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Doc/lib/libpickle.tex b/Doc/lib/libpickle.tex index 2f5d2ec..92a7989 100644 --- a/Doc/lib/libpickle.tex +++ b/Doc/lib/libpickle.tex @@ -144,8 +144,9 @@ much more efficient pickling of new-style classes. Refer to PEP 307 for more information. If a \var{protocol} is not specified, protocol 0 is used. -If \var{protocol} is specified as a negative value, -the highest protocol version will be used. +If \var{protocol} is specified as a negative value +or \constant{HIGHEST_PROTOCOL}, +the highest protocol version available will be used. \versionchanged[The \var{bin} parameter is deprecated and only provided for backwards compatibility. You should use the \var{protocol} @@ -162,6 +163,14 @@ To serialize an object hierarchy, you first create a pickler, then you call the pickler's \method{dump()} method. To de-serialize a data stream, you first create an unpickler, then you call the unpickler's \method{load()} method. The \module{pickle} module provides the +following constant: + +\begin{datadesc}{HIGHEST_PROTOCOL} +The highest protocol version available. This value can be passed +as a \var{protocol} value. +\end{datadesc} + +The \module{pickle} module provides the following functions to make this process more convenient: \begin{funcdesc}{dump}{object, file\optional{, protocol\optional{, bin}}} @@ -170,7 +179,8 @@ Write a pickled representation of \var{object} to the open file object \code{Pickler(\var{file}, \var{protocol}, \var{bin}).dump(\var{object})}. If the \var{protocol} parameter is ommitted, protocol 0 is used. -If \var{protocol} is specified as a negative value, +If \var{protocol} is specified as a negative value +or \constant{HIGHEST_PROTOCOL}, the highest protocol version will be used. \versionchanged[The \var{protocol} parameter was added. @@ -209,7 +219,8 @@ Return the pickled representation of the object as a string, instead of writing it to a file. If the \var{protocol} parameter is ommitted, protocol 0 is used. -If \var{protocol} is specified as a negative value, +If \var{protocol} is specified as a negative value +or \constant{HIGHEST_PROTOCOL}, the highest protocol version will be used. \versionchanged[The \var{protocol} parameter was added. |