Segmenting a pickle stream without unpickling

Boris Borcic bborcic at gmail.com
Fri May 19 10:44:03 CEST 2006


Assuming that the items of my_stream share no content (they are
dumps of db cursor fetches), is there a simple way to do the
equivalent of

def pickles(my_stream) :
     from cPickle import load,dumps
     while 1 :
         yield dumps(load(my_stream))

without the overhead associated with unpickling objects
just to pickle them again ?

TIA, Boris Borcic



More information about the Python-list mailing list