Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="module-shelve.html" /> | |
13 | <link rel="prev" href="module-cPickle.html" /> | |
14 | <link rel="parent" href="python.html" /> | |
15 | <link rel="next" href="module-shelve.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>3.16 copy_reg -- Register pickle support functions</title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="3.15 cPickle " | |
25 | href="module-cPickle.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="3. Python Runtime Services" | |
28 | href="python.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="3.17 shelve " | |
31 | href="module-shelve.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="module-cPickle.html">3.15 cPickle </A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="python.html">3. Python Runtime Services</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="module-shelve.html">3.17 shelve </A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H1><A NAME="SECTION0051600000000000000000"> | |
56 | 3.16 <tt class="module">copy_reg</tt> -- | |
57 | Register <tt class="module">pickle</tt> support functions</A> | |
58 | </H1> | |
59 | ||
60 | <P> | |
61 | <A NAME="module-copyreg"></A> | |
62 | ||
63 | <P> | |
64 | The <tt class="module">copy_reg</tt> module provides support for the | |
65 | <tt class="module"><a href="module-pickle.html">pickle</a></tt><a id='l2h-662' xml:id='l2h-662'></a> and | |
66 | <tt class="module"><a href="module-cPickle.html">cPickle</a></tt><a id='l2h-663' xml:id='l2h-663'></a> modules. The | |
67 | <tt class="module"><a href="module-copy.html">copy</a></tt><a id='l2h-664' xml:id='l2h-664'></a> module is likely to use this in the | |
68 | future as well. It provides configuration information about object | |
69 | constructors which are not classes. Such constructors may be factory | |
70 | functions or class instances. | |
71 | ||
72 | <P> | |
73 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
74 | <td><nobr><b><tt id='l2h-660' xml:id='l2h-660' class="function">constructor</tt></b>(</nobr></td> | |
75 | <td><var>object</var>)</td></tr></table></dt> | |
76 | <dd> | |
77 | Declares <var>object</var> to be a valid constructor. If <var>object</var> is | |
78 | not callable (and hence not valid as a constructor), raises | |
79 | <tt class="exception">TypeError</tt>. | |
80 | </dl> | |
81 | ||
82 | <P> | |
83 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
84 | <td><nobr><b><tt id='l2h-661' xml:id='l2h-661' class="function">pickle</tt></b>(</nobr></td> | |
85 | <td><var>type, function</var><big>[</big><var>, constructor</var><big>]</big><var></var>)</td></tr></table></dt> | |
86 | <dd> | |
87 | Declares that <var>function</var> should be used as a ``reduction'' | |
88 | function for objects of type <var>type</var>; <var>type</var> must not be a | |
89 | ``classic'' class object. (Classic classes are handled differently; | |
90 | see the documentation for the <tt class="module"><a href="module-pickle.html">pickle</a></tt> module for | |
91 | details.) <var>function</var> should return either a string or a tuple | |
92 | containing two or three elements. | |
93 | ||
94 | <P> | |
95 | The optional <var>constructor</var> parameter, if provided, is a | |
96 | callable object which can be used to reconstruct the object when | |
97 | called with the tuple of arguments returned by <var>function</var> at | |
98 | pickling time. <tt class="exception">TypeError</tt> will be raised if | |
99 | <var>object</var> is a class or <var>constructor</var> is not callable. | |
100 | ||
101 | <P> | |
102 | See the <tt class="module"><a href="module-pickle.html">pickle</a></tt> module for more | |
103 | details on the interface expected of <var>function</var> and | |
104 | <var>constructor</var>. | |
105 | </dl> | |
106 | ||
107 | <DIV CLASS="navigation"> | |
108 | <div class='online-navigation'> | |
109 | <p></p><hr /> | |
110 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
111 | <tr> | |
112 | <td class='online-navigation'><a rel="prev" title="3.15 cPickle " | |
113 | href="module-cPickle.html"><img src='../icons/previous.png' | |
114 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
115 | <td class='online-navigation'><a rel="parent" title="3. Python Runtime Services" | |
116 | href="python.html"><img src='../icons/up.png' | |
117 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
118 | <td class='online-navigation'><a rel="next" title="3.17 shelve " | |
119 | href="module-shelve.html"><img src='../icons/next.png' | |
120 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
121 | <td align="center" width="100%">Python Library Reference</td> | |
122 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
123 | href="contents.html"><img src='../icons/contents.png' | |
124 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
125 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
126 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
127 | <td class='online-navigation'><a rel="index" title="Index" | |
128 | href="genindex.html"><img src='../icons/index.png' | |
129 | border='0' height='32' alt='Index' width='32' /></A></td> | |
130 | </tr></table> | |
131 | <div class='online-navigation'> | |
132 | <b class="navlabel">Previous:</b> | |
133 | <a class="sectref" rel="prev" href="module-cPickle.html">3.15 cPickle </A> | |
134 | <b class="navlabel">Up:</b> | |
135 | <a class="sectref" rel="parent" href="python.html">3. Python Runtime Services</A> | |
136 | <b class="navlabel">Next:</b> | |
137 | <a class="sectref" rel="next" href="module-shelve.html">3.17 shelve </A> | |
138 | </div> | |
139 | </div> | |
140 | <hr /> | |
141 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
142 | </DIV> | |
143 | <!--End of Navigation Panel--> | |
144 | <ADDRESS> | |
145 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
146 | </ADDRESS> | |
147 | </BODY> | |
148 | </HTML> |