[Python-3000] pickle compatibility between 2.x and 3.0

Bill Janssen janssen at parc.com
Thu Nov 1 17:36:11 CET 2007

> I could leave this all up to the 3.0 application, which would have to
> "fix up" any bytes in the pickle it receives explicitly if it wants
> to. Alternatively, I could add an encoding option to the pickle
> loading APIs (and for full flexibility an errors option as well) so
> that at least simple text-based applications might have a chance of
> reading the data that they themselves wrote before they were ported to
> 3.0 with minimal changes (only the unpickling calls would have to be
> modified).

I like this idea.  I'd suggest just a global encoding option, and
making the default be null; that is, if your program didn't set a
default pickle string encoding, you get bytes, which is almost
certainly the right thing to do.  But if you've set a default
encoding, you get a string.  Then "simple text-based applications"
only have to add one line to get the behavior they expect.


More information about the Python-3000 mailing list