[Python-Dev] [ 654866 ] pickle and cPickle not equivalent

Patrick K. O'Brien pobrien@orbtech.com
Wed, 18 Dec 2002 10:22:52 -0600


On Wednesday 18 December 2002 10:00 am, Guido van Rossum wrote:
> I have to admit that the "multiple calls to dump()" feature
> is not often used; maybe it should be deprecated so we don't make
> promises we can't fulfill.  E.g. Zope never uses this.

Since it works 99% of the time, I'd rather fix it and make it work 100% 
of the time. If it can't be fixed, the promises made in the docs should 
be tempered. See my next suggestion first.

Here is another thought that might outway the performance concerns: for 
whatever reason, all instances of new-style classes (even with refcount 
== 1, or perhaps because they don't have a refcount == 1) *are* getting 
put in the cPickle memo. If the goal is to move from old-style to 
new-style, we're already taking a performace hit with new-style class 
instances. So why not pay the price with old-style as well and put them 
in the cPickle memo? Then the discrepancy between pickle and cPickle 
goes away, and this "multiple dump" feature works as advertised.

Or create a second version of cPickle that does work exactly the same as 
pickle. It will still have a performance benefit over pickle and it 
won't be any slower than the regular cPickle if all your instances are 
of new-style classes. Just thinking out loud.

> > In any case, I've submitted the following documentation bug report
> > on SF:
> >
> >   [ 655802 ] cPickle not always same as pickle
>
> You could help by submitting a doc patch that satisfies your
> desire for more clear and honest docs.  If you don't know LaTeX, that
> doesn't matter; just pretend it's plain text and somebody will fix up
> the markup, as long as you provide the new words.

I'll add this to my todo list, assuming you don't like my suggestions 
above. My documentation bug report contained annotations that suggest 
some wording changes already, but I'm sure Fred would prefer patches 
with specific revisions.

-- 
Patrick K. O'Brien
Orbtech      http://www.orbtech.com/web/pobrien
-----------------------------------------------
"Your source for Python programming expertise."
-----------------------------------------------