1 | \section{\module{copy_reg} ---
|
---|
2 | Register \module{pickle} support functions}
|
---|
3 |
|
---|
4 | \declaremodule[copyreg]{standard}{copy_reg}
|
---|
5 | \modulesynopsis{Register \module{pickle} support functions.}
|
---|
6 |
|
---|
7 |
|
---|
8 | The \module{copy_reg} module provides support for the
|
---|
9 | \refmodule{pickle}\refstmodindex{pickle}\ and
|
---|
10 | \refmodule{cPickle}\refbimodindex{cPickle}\ modules. The
|
---|
11 | \refmodule{copy}\refstmodindex{copy}\ module is likely to use this in the
|
---|
12 | future as well. It provides configuration information about object
|
---|
13 | constructors which are not classes. Such constructors may be factory
|
---|
14 | functions or class instances.
|
---|
15 |
|
---|
16 |
|
---|
17 | \begin{funcdesc}{constructor}{object}
|
---|
18 | Declares \var{object} to be a valid constructor. If \var{object} is
|
---|
19 | not callable (and hence not valid as a constructor), raises
|
---|
20 | \exception{TypeError}.
|
---|
21 | \end{funcdesc}
|
---|
22 |
|
---|
23 | \begin{funcdesc}{pickle}{type, function\optional{, constructor}}
|
---|
24 | Declares that \var{function} should be used as a ``reduction''
|
---|
25 | function for objects of type \var{type}; \var{type} must not be a
|
---|
26 | ``classic'' class object. (Classic classes are handled differently;
|
---|
27 | see the documentation for the \refmodule{pickle} module for
|
---|
28 | details.) \var{function} should return either a string or a tuple
|
---|
29 | containing two or three elements.
|
---|
30 |
|
---|
31 | The optional \var{constructor} parameter, if provided, is a
|
---|
32 | callable object which can be used to reconstruct the object when
|
---|
33 | called with the tuple of arguments returned by \var{function} at
|
---|
34 | pickling time. \exception{TypeError} will be raised if
|
---|
35 | \var{object} is a class or \var{constructor} is not callable.
|
---|
36 |
|
---|
37 | See the \refmodule{pickle} module for more
|
---|
38 | details on the interface expected of \var{function} and
|
---|
39 | \var{constructor}.
|
---|
40 | \end{funcdesc}
|
---|