Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / html / python / lib / module-cPickle.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="lib.html" title='Python Library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="module-copyreg.html" />
<link rel="prev" href="module-pickle.html" />
<link rel="parent" href="python.html" />
<link rel="next" href="module-copyreg.html" />
<meta name='aesop' content='information' />
<title>3.15 cPickle -- A faster pickle</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="3.14.7 Example"
href="pickle-example.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="3. Python Runtime Services"
href="python.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="3.16 copy_reg "
href="module-copyreg.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="pickle-example.html">3.14.7 Example</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="python.html">3. Python Runtime Services</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-copyreg.html">3.16 copy_reg </A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION0051500000000000000000">
3.15 <tt class="module">cPickle</tt> -- A faster <tt class="module">pickle</tt></A>
</H1>
<P>
<A NAME="module-cPickle"></A>
<P>
The <tt class="module">cPickle</tt> module supports serialization and
de-serialization of Python objects, providing an interface and
functionality nearly identical to the
<tt class="module"><a href="module-pickle.html">pickle</a></tt><a id='l2h-658' xml:id='l2h-658'></a> module. There are several
differences, the most important being performance and subclassability.
<P>
First, <tt class="module">cPickle</tt> can be up to 1000 times faster than
<tt class="module">pickle</tt> because the former is implemented in C. Second, in
the <tt class="module">cPickle</tt> module the callables <tt class="function">Pickler()</tt> and
<tt class="function">Unpickler()</tt> are functions, not classes. This means that
you cannot use them to derive custom pickling and unpickling
subclasses. Most applications have no need for this functionality and
should benefit from the greatly improved performance of the
<tt class="module">cPickle</tt> module.
<P>
The pickle data stream produced by <tt class="module">pickle</tt> and
<tt class="module">cPickle</tt> are identical, so it is possible to use
<tt class="module">pickle</tt> and <tt class="module">cPickle</tt> interchangeably with existing
pickles.<A NAME="tex2html23"
HREF="#foot8958"><SUP>3.11</SUP></A>
<P>
There are additional minor differences in API between <tt class="module">cPickle</tt>
and <tt class="module">pickle</tt>, however for most applications, they are
interchangeable. More documentation is provided in the
<tt class="module">pickle</tt> module documentation, which
includes a list of the documented differences.
<P>
<BR><HR><H4>Footnotes</H4>
<DL>
<DT><A NAME="foot8958">...
pickles.</A><A
href="module-cPickle.html#tex2html23"><SUP>3.11</SUP></A></DT>
<DD>Since the pickle data format is actually a tiny
stack-oriented programming language, and some freedom is taken in the
encodings of certain objects, it is possible that the two modules
produce different data streams for the same input objects. However it
is guaranteed that they will always be able to read each other's
data streams.
</DD>
</DL>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="3.14.7 Example"
href="pickle-example.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="3. Python Runtime Services"
href="python.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="3.16 copy_reg "
href="module-copyreg.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="pickle-example.html">3.14.7 Example</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="python.html">3. Python Runtime Services</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-copyreg.html">3.16 copy_reg </A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>