[Python-3000] Simplifying pickle for Py3k

Georg Brandl g.brandl at gmx.net
Wed Oct 3 20:36:19 CEST 2007


Neil Schemenauer schrieb:
> I guess the library overhaul hasn't really started it but it would
> be nice if the pickle module could get some work.  Today I'm trying
> to efficiently store a class using pickle and the documentation is
> making my head hurt.  I don't think the documentation itself is the
> problem, just the fact that the rules are so complicated.
> 
> I guess there are several different solutions:
> 
>     * Remove backwards compatible stuff from the code and the
>       documentation.  The downside is that old pickles could not be
>       loaded.  Perhaps that's not a huge issue since the removal of
>       old-style classes might already break old pickles.
> 
>     * Remove the backwards compatible stuff from the documentation
>       only.  The would help people using the language but would
>       still be a long term maintenance issue.
> 
>     * Leave the old code in but generate warnings when old pickle
>       mechanisms are used.  Eventually the old stuff could be
>       removed from the code.
> 
>     * Provide an "oldpickle" module the supports pre-3k pickles.
> 
> I think I like the warnings idea best.

I'm in favor of #1, perhaps combined with #4. With the fundamental
change in basic types (unicode -> str, str -> bytes) I wouldn't
expect 2.x pickles to be loadable by 3.0 anyway.

Cruft removal from the pickle protocol is really needed; I don't envy
everyone reading the pickle docs trying to understand which method
exactly he has to implement, which is going to be called with what
arguments, etc.

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.



More information about the Python-3000 mailing list