Issue 891249: pickle dump argument description vague (original) (raw)

The documentation for pickle.dump()

see http://www.python.org/doc/current/lib/node64.html

dump( object, file[, protocol[, bin]])

implies that up to four arguments can be specified. That bin can be specified if protocol has been specified. The implementation actually accepts only 3 arguments, the last one being either 'protocol' or a 'bin' flag.

The text notation for this function needs to be clarified, and the visual presentation of the argument functions changed.

Perhaps to:

dump( object, file[, protocol | bin])

or

dump( object, file[, protocol] | [, bin])

or

dump( object, file[, protocol_or_bin])

Logged In: YES user_id=129426

There is one other thing. The cPickle dump/dumps functions don't like the 'bin' argument at all: TypeError: 'bin' is an invalid keyword argument for this function They only accept the 'protocol' argument.

So that's another thing that should probably be changed in cPickle (also see bug 888594), or it should probably be mentioned in the docs, or the 'bin' argument should be removed totally ;-)