[Python-Dev] when is binary mode required for pickle?
Tim Peters
tim.one@comcast.net
Thu, 13 Feb 2003 10:14:39 -0500
[Gareth McCaughan]
> Suggestion: pickle.LATEST_PROTOCOL = cPickle.LATEST_PROTOCOL = -1 ?
> (It could be spelled differently.) Or the string value "latest"
> could be an acceptable value of proto. Or something. Anything rather
> than magic numbers. :-)
I'm going to add HIGHEST_PROTOCOL = 2 for 2.3 -- thanks for the idea.
Note that it doesn't address quite the same problem, though: it won't exist
before 2.3, so current code can't use it. You can pass -1 today to get the
highest protocol available (more by accident than by design), and your code
will continue to get the highest available in 2.3 without further ado.
BTW, -1 didn't bother me: I viewed it as indexing into a (conceptual) list
of available protocol numbers. -1 generally has a "get the last" meaning,
and we'll conveniently ignore that -716 had the same meaning here <wink>.