Fred Drake | 3a0351c | 1998-04-04 07:23:21 +0000 | [diff] [blame] | 1 | \section{Standard Module \module{copy_reg}} |
Fred Drake | 1abf0df | 1998-01-21 04:58:10 +0000 | [diff] [blame] | 2 | % Note that the label is a little off; the underscore causes LaTeX to |
| 3 | % yell & scream. |
| 4 | \label{module-copyreg} |
| 5 | \stmodindex{copy_reg} |
| 6 | |
| 7 | The \code{copy_reg} module provides support for the |
| 8 | \code{pickle}\refstmodindex{pickle} and |
| 9 | \code{cPickle}\refbimodindex{cPickle} modules. The |
| 10 | \code{copy}\refstmodindex{copy} module is likely to use this in the |
| 11 | future as well. It provides configuration information about object |
| 12 | constructors which are not classes. Such constructors may be factory |
| 13 | functions or class instances. |
| 14 | |
Fred Drake | 1abf0df | 1998-01-21 04:58:10 +0000 | [diff] [blame] | 15 | |
| 16 | \begin{funcdesc}{constructor}{object} |
| 17 | Declares \var{object} to be a valid constructor. |
| 18 | \end{funcdesc} |
| 19 | |
| 20 | \begin{funcdesc}{pickle}{type, function\optional{, constructor}} |
| 21 | Declares that \var{function} should be used as a ``reduction'' |
| 22 | function for objects of type or class \var{type}. \var{function} |
| 23 | should return either a string or a tuple. The optional |
| 24 | \var{constructor} parameter, if provided, is a callable object which |
| 25 | can be used to reconstruct the object when called with the tuple of |
| 26 | arguments returned by \var{function} at pickling time. |
| 27 | \end{funcdesc} |