def to_string(obj): """ .. todo:: WRITEME """ return cPickle.dumps(obj, get_pickle_protocol())
def clone_via_serialize(obj): """ .. todo:: WRITEME """ s = cPickle.dumps(obj, get_pickle_protocol()) return cPickle.loads(s)
def to_string(obj): """ Serializes an object to a string. Parameters ---------- obj : object The object to serialize. Returns ------- string : str The object serialized as a string. """ return cPickle.dumps(obj, get_pickle_protocol())
def clone_via_serialize(obj): """ Makes a "deep copy" of an object by serializing it and then deserializing it. Parameters ---------- obj : object The object to clone. Returns ------- obj2 : object A copy of the object. """ s = cPickle.dumps(obj, get_pickle_protocol()) return cPickle.loads(s)