I saw these two answers about Pickle and cPickle having dealt automatically by python 3, transparent to the user:
How can I know if in python 3, it is using the fast version (cPickle) or not? I want to force it to use cPickle. My main interest is not even on the speed, but on the shorter size of the files, since I am generating files that end up being bigger than 1 GB.
Unless you build your Python binary from source, you almost certainly are using the C extension.
However, if you must be certain, check if the _pickle
module can be imported:
>>> import _pickle
The pickle
module imports _pickle
and only if that fails with an ImportError
would it be using the pure-Python implementation.
Just to be explicit: what was called cPickle
in Python 2 has been renamed to _pickle
and is imported transparently, you don't have to do anything explicit to make use of it. That there was a split between pickle
and cPickle
in Python 2 was just plain confusing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With