[Python-Dev] pickle.dump(..) interface change ... documentation
Guido van Rossum
guido at python.org
Wed Feb 4 16:05:12 EST 2004
> I just ran across something that looks like a very unfortunate interface
> change in the pickle module:
>
> Python 2.2: dump(object, file[, bin])
> Python 2.3: dump(object, file[, protocol[, bin]])
>
> ...and indeed I have code, which uses pickle.dump(obj, f, True).
>
> Hmm, ok, so probably this means now (under python 2.3) I'm using
> protocol number 1 (==True)?! Tricky. :-) Maybe that warrants a comment
> in the docs?
Are you sure you aren't misreading the docs?
The number of arguments is the same. It's just that what was a
boolean in 2.2 is an int in 2.3. IOW, protocol 0 is the old "text"
protocol, protocol 1 is the old "binary" protocol, and protocol 2 is
a new protocol introduced in Python 2.3. And indeed, 0==False,
1==True.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list