Website hosting service by Active-Venture.com
  

 Back to Index

3.14.2 Data stream format

The data format used by pickle is Python-specific. This has the advantage that there are no restrictions imposed by external standards such as XDR (which can't represent pointer sharing); however it means that non-Python programs may not be able to reconstruct pickled Python objects.

By default, the pickle data format uses a printable ASCII representation. This is slightly more voluminous than a binary representation. The big advantage of using printable ASCII (and of some other characteristics of pickle's representation) is that for debugging or recovery purposes it is possible for a human to read the pickled file with a standard text editor.

There are currently 3 different protocols which can be used for pickling.

 

  • Protocol version 0 is the original ASCII protocol and is backwards compatible with earlier versions of Python.

     

  • Protocol version 1 is the old binary format which is also compatible with earlier versions of Python.

     

  • Protocol version 2 was introduced in Python 2.3. It provides much more efficient pickling of new-style classes.

     

Refer to PEP 307 for more information.

If a protocol is not specified, protocol 0 is used. If protocol is specified as a negative value or HIGHEST_PROTOCOL, the highest protocol version available will be used.

Changed in version 2.3: The bin parameter is deprecated and only provided for backwards compatibility. You should use the protocol parameter instead.

A binary format, which is slightly more efficient, can be chosen by specifying a true value for the bin argument to the Pickler constructor or the dump() and dumps() functions. A protocol version >= 1 implies use of a binary format.

  

 

2002-2004 Active-Venture.com Webhosting Service

 

Disclaimer: This documentation is provided only for the benefits of our hosting customers.
For authoritative source of the documentation, please refer to http://python.org/doc/

 

Active-Domain.com offers domain name registration, domain name transfer and domain search services  

Cheap domain registration : Register domain name or buy domain name, including free domain hosting services

 
 

Domain registration : Buy domain name or register domain name from $5.95/year only