Staging
v0.5.1
Revision bb5c6f8529c89d2396a3e3c06cf575a130ff7a0e authored by Guido van Rossum on 29 April 1997, 20:42:30 UTC, committed by Guido van Rossum on 29 April 1997, 20:42:30 UTC
1 parent 87490eb
Raw File
copy_reg.py
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

def pickle_complex(c):
    return complex,(c.real, c.imag)

pickle(type(1j),pickle_complex,complex)

back to top