python3 中的 Pickle 与 cPickle (?)
Pickle vs cPickle (?) in python3
曾经有cPickle
in python2.7. However, I don't see it anymore in python3 pickle
。该模块发生了什么,是否已合并到常规 pickle
模块中?
在 Python 2.7 中有一个纯 Python 版本和一个用 C 实现的性能优化 cPickle
。现在,只保留了后者的实现,但名称更简单。
这种名称统一方法始于 Python 3。请参阅 Guido var Rossum 的 "What's new in Python 3" 中的摘录:
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.
曾经有cPickle
in python2.7. However, I don't see it anymore in python3 pickle
。该模块发生了什么,是否已合并到常规 pickle
模块中?
在 Python 2.7 中有一个纯 Python 版本和一个用 C 实现的性能优化 cPickle
。现在,只保留了后者的实现,但名称更简单。
这种名称统一方法始于 Python 3。请参阅 Guido var Rossum 的 "What's new in Python 3" 中的摘录:
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.