1. Home
  2. Computing & Technology
  3. Python
Python Blog

From Al Lukaszewski, Former About.com Guide to Python

Using cPickle Instead of Python's marshal Module

Sunday August 26, 2007
Python's marshal module is, as the Python documentation states, not a general persistence module. It is not meant for saving sessional values but for working with the pseudo-compiled code of compiled Python programs (*.pyc).

In general, pickle should be used instead of marshal. The former is more flexible; the latter is faster. One reason for this speed is because marshal does not have the security of pickle. It is not secured against malicious or badly formed data.

If speed is of the essence, however, you should consider cPickle. Written in C, cPickle has much the same functionality as pickle but is around 1000 times faster.
Explore Python
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Python

©2009 About.com, a part of The New York Times Company.

All rights reserved.