[Python-Dev] new features for 2.3?

Delaney, Timothy tdelaney@avaya.com
Thu, 9 Jan 2003 10:16:58 +1100


> From: Guido van Rossum [mailto:guido@python.org]
> 
> We can do that in Python 2.3.  Because this is backwards incompatible,
> I propose that you have to request this protocol explicitly.  I
> propose to "upgrade' the binary flag to a general "protocol version"
> flag, with values:
> 
> 0 - original protocol
> 1 - binary protocol
> 2 - new protocol

If you're going to do this, why not go all the way, and encode the python
version in the protocol? The value to use could be encoded as constants in
pickle.py (and cPickle), with a CURRENT_PROTOCOL or some such to make things
easy.

It might also be an idea to allow passing `sys.version_info`.

The thing I'm trying to avoid is a proliferation of magic numbers when
pickling ... what happens when we get another backwards-incompatible feature
... do we bump the number up to 3 and call it 'newer protocol'?

I think using pickle constants (be they version numbers or otherwise) is the
way to go here.

Tim Delaney