I do not use Python a lot, but is there a reason why you could not just saw the array? Thus, the etching becomes
s = pickle.dumps([o1,o2,o3])
and reconstruction becomes
objs = pickle.loads(s)
Edit 1: Also, according to this answer , the pickled yield is self-limited; that way you can pickle with
s = ''.join(map(pickle.dumps,[o1,o2,o3]))
and restore using
import StringIO sio = StringIO.StringIO(s) objs = [] try: while True: objs.append(pickle.load(sio)) catch EOFError: pass
I'm not sure there is an advantage to this. (Although I haven't seen it, maybe it's better than this nasty loop / exception combination, as I said, I don't use Python much.)
Antal spector-zabusky
source share