[Python-Dev] For review: PEP 307 - Extensions to the pickle protocol

M.-A. Lemburg mal@lemburg.com
Sat, 08 Feb 2003 16:03:57 +0100


Guido van Rossum wrote:
> I'm assuming a fair number of people have been following this already
> in the checkins list; I think it's ready for review on python-dev:
> 
>   http://www.python.org/peps/pep-0307.html
> 
> Quoting the introduction:
> 
>     Pickling new-style objects in Python 2.2 is done somewhat clumsily
>     and causes pickle size to bloat compared to classic class
>     instances.  This PEP documents a new pickle protocol in Python 2.3
>     that takes care of this and many other pickle issues.
> 
>     There are two sides to specifying a new pickle protocol: the byte
>     stream constituting pickled data must be specified, and the
>     interface between objects and the pickling and unpickling engines
>     must be specified.  This PEP focuses on API issues, although it
>     may occasionally touch on byte stream format details to motivate a
>     choice.  The pickle byte stream format is documented formally by
>     the standard library module pickletools.py (already checked into
>     CVS for Python 2.3).
> 
>     This PEP attempts to fully document the interface between pickled
>     objects and the pickling process, highlighting additions by
>     specifying "new in this PEP".  (The interface to invoke pickling
>     or unpickling is not covered fully, except for the changes to the
>     API for specifying the pickling protocol to picklers.)

That's nice to have :-) (previously I had to look those things
up in the code itself... to the point where I simply didn't
understand the various gimmicks)

As long as pickle.py stays backwards compatible w/r to subclasses,
I don't mind having a better alternative for the future at hand :-)

If you do change the APIs, though, I'd consider adding new
classes for Pickler and Unpickler (even if you have changed
interna, because existing subclasses are likely to have been
built on these as well simply because the code was never
properly documented -- I know, because I did exactly this couple
of time :-).

Will cPickle also be updated according to the new features
in pickle.py ?

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
_______________________________________________________________________
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/