Added info about the new HIGHEST_PROTOCOL module constant.

This commit is contained in:
Tim Peters 2003-02-13 16:08:06 +00:00
parent fa6660b886
commit 6f28699bc4
1 changed files with 6 additions and 1 deletions

View File

@ -87,7 +87,12 @@ Protocol versions
Python versions had the same effect as passing 1. Nevertheless, a
special case is added here: passing a negative number selects the
highest protocol version supported by a particular implementation.
This works in previous Python versions, too.
This works in previous Python versions, too, and so can be used to
select the highest protocol available in a way that's both backward
and forward compatible. In addition, a new module constant
HIGHEST_PROTOCOL is supplied by both pickle and cPickle, equal to
the highest protocol number the module can read. This is cleaner
than passing -1, but cannot be used before Python 2.3.
The pickle.py module has supported passing the 'bin' value as a
keyword argument rather than a positional argument. (This is not