summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2007-10-31 22:02:21 (GMT)
committerRaymond Hettinger <python@rcn.com>2007-10-31 22:02:21 (GMT)
commit9afdaffa3329741e95490182a5a99864d0dc1703 (patch)
tree7f7f8e6e785a75334eb04eb50d847f4e0dc0353a /Doc
parent9b12e0019e74e8c688ae659abf27c5f7bb4705c1 (diff)
downloadcpython-9afdaffa3329741e95490182a5a99864d0dc1703.zip
cpython-9afdaffa3329741e95490182a5a99864d0dc1703.tar.gz
cpython-9afdaffa3329741e95490182a5a99864d0dc1703.tar.bz2
Clarify the reasons why pickle is almost always better than marshal
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libmarshal.tex10
1 files changed, 9 insertions, 1 deletions
diff --git a/Doc/lib/libmarshal.tex b/Doc/lib/libmarshal.tex
index 63ff392..bf3828f 100644
--- a/Doc/lib/libmarshal.tex
+++ b/Doc/lib/libmarshal.tex
@@ -26,7 +26,9 @@ mainly to support reading and writing the ``pseudo-compiled'' code for
Python modules of \file{.pyc} files. Therefore, the Python
maintainers reserve the right to modify the marshal format in backward
incompatible ways should the need arise. If you're serializing and
-de-serializing Python objects, use the \module{pickle} module instead.
+de-serializing Python objects, use the \module{pickle} module instead
+ --- the performance is comparable, version independence is guaranteed,
+and pickle supports a substantially wider range of objects than marshal.
\refstmodindex{pickle}
\refstmodindex{shelve}
\obindex{code}
@@ -47,6 +49,12 @@ dictionaries are only supported as long as the values contained
therein are themselves supported; and recursive lists and dictionaries
should not be written (they will cause infinite loops).
+\begin{notice}[warning]
+Some unsupported types such as subclasses of builtins will appear to marshal
+and unmarshal correctly, but in fact, their type will change and the
+additional subclass functionality and instance attributes will be lost.
+\end{notice}
+
\strong{Caveat:} On machines where C's \code{long int} type has more than
32 bits (such as the DEC Alpha), it is possible to create plain Python
integers that are longer than 32 bits.