1

There used to be cPickle in python2.7. However, I don't see it anymore in python3 pickle. What ever happened to that module, did it get merged into the regular pickle module?

sophros
  • 14,672
  • 11
  • 46
  • 75
David542
  • 104,438
  • 178
  • 489
  • 842

1 Answers1

2

In Python 2.7 there was a pure Python version and a performance optimized cPickle implemented in C. Now, only the latter implementation stayed but with the simpler name.

This name-unification approach started with Python 3. Please see an excerpt from "What's new in Python 3" by Guido var Rossum:

A common pattern in Python 2.x is to have one version of a module implemented in pure Python, with an optional accelerated version implemented as a C extension; for example, pickle and cPickle. This places the burden of importing the accelerated version and falling back on the pure Python version on each user of these modules. In Python 3.0, the accelerated versions are considered implementation details of the pure Python versions. Users should always import the standard version, which attempts to import the accelerated version and falls back to the pure Python version. The pickle / cPickle pair received this treatment.

sophros
  • 14,672
  • 11
  • 46
  • 75