Staging
v0.8.1
v0.8.1
Revision 22cf34795534220f1bf47013e4a7f0a5502ba3fb authored by cvs2svn on 26 November 1997, 21:20:51 UTC, committed by cvs2svn on 26 November 1997, 21:20:51 UTC
1 parent 8253671
copy_reg.py
# Helper to provide extensibility for pickle/cPickle.
dispatch_table = {}
safe_constructors = {}
def pickle(ob_type, pickle_function, constructor_ob = None):
dispatch_table[ob_type] = pickle_function
if constructor_ob is not None:
constructor(constructor_ob)
def constructor(object):
safe_constructors[object] = 1
# Example: provide pickling support for complex numbers.
def pickle_complex(c):
return complex, (c.real, c.imag)
pickle(type(1j), pickle_complex, complex)
Computing file changes ...