[Python-Dev] Pickling buffer objects.

Travis Oliphant oliphant at ee.byu.edu
Tue Apr 19 21:13:40 CEST 2005

Greg Ewing wrote:

> Travis Oliphant wrote:
>> I'm proposing to pickle the buffer object so that it unpickles as a 
>> string.
> Wouldn't this mean you're only solving half the problem?
> Unpickling a Numeric array this way would still use an
> intermediate string.

Well, actually, unpickling in the new numeric uses the intermediate 
string as the memory (yes, I know it's not supposed to be "mutable", but 
without a mutable bytes object what else are you supposed to do?). 

Thus, ideally we would have a mutable-bytes object with a separate 
pickle opcode.  Without this, then we overuse the string object.  But, 
since the string is only created by the pickle (and nobody else uses it, 
then what's the real harm).

So, in reality the previously-mentioned patch together with 
modificiations to Numeric's unpickling code actually solves the whole 


More information about the Python-Dev mailing list