copy_reg

The copy_reg module extends the capabilities of the pickle and cPickle modules to handle the serialization of objects described by extension types (as defined in C extension modules). To do this, extension writers use this module to register reduction and construction functions that are used to serialize and unserialize an object, respectively.

constructor(cfunc)

Declares cfunc to be a valid constructor function. cfunc must be a callable object that accepts the tuple of values returned by the reduction function given to the pickle() function.

pickle(type, rfunc [, cfunc])

Registers rfunc as a reduction function for objects of type type.rfunc is a function that takes an object of the specified type and returns a tuple containing the constructor ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.