酸洗和序列化之间有什么区别吗?
Is there any difference between Pickling and Serialization?
我在阅读有关 python 对象的文章时经常遇到这两个术语。但是,酸洗和序列化之间存在混淆,因为我在一个地方阅读
The pickle module implements an algorithm for turning an arbitrary
Python object into a series of bytes. This process is also called
serializing” the object.
如果序列化和酸洗是同一个过程,为什么对它们使用不同的术语?
in python pickle
指的是提供python 对象(特定)序列化的模块。
序列化本身是一个更笼统的术语。例如,python 对象也可以序列化为 json。
您误读了这篇文章。酸洗和序列化不是同义词,文本也没有声称它们是同义词。
稍微解释一下,文本说这个:
This module implements an algorithm for turning an object into a series of bytes. This process is also called serializing the object.
我故意删除了模块名称 pickle
。该模块实现了一个过程,一个算法,这个过程通常被称为序列化。
该过程还有其他实现。您可以使用 JSON 或 XML 将数据序列化为文本。还有就是marshal
module. Other languages have other serialization formats; the R language has one, so does Java。等等
见WikiPedia article on the subject:
In computer science, in the context of data storage, serialization is the process of translating data structures or object state into a format that can be stored (for example, in a file or memory buffer, or transmitted across a network connection link) and reconstructed later in the same or another computer environment.
Python 选择名称 pickle
因为它模仿了 Modula-3, where it was also called pickling. See Pickles: Why are they called that?
中的处理方式
我在阅读有关 python 对象的文章时经常遇到这两个术语。但是,酸洗和序列化之间存在混淆,因为我在一个地方阅读
The pickle module implements an algorithm for turning an arbitrary Python object into a series of bytes. This process is also called serializing” the object.
如果序列化和酸洗是同一个过程,为什么对它们使用不同的术语?
in python pickle
指的是提供python 对象(特定)序列化的模块。
序列化本身是一个更笼统的术语。例如,python 对象也可以序列化为 json。
您误读了这篇文章。酸洗和序列化不是同义词,文本也没有声称它们是同义词。
稍微解释一下,文本说这个:
This module implements an algorithm for turning an object into a series of bytes. This process is also called serializing the object.
我故意删除了模块名称 pickle
。该模块实现了一个过程,一个算法,这个过程通常被称为序列化。
该过程还有其他实现。您可以使用 JSON 或 XML 将数据序列化为文本。还有就是marshal
module. Other languages have other serialization formats; the R language has one, so does Java。等等
见WikiPedia article on the subject:
In computer science, in the context of data storage, serialization is the process of translating data structures or object state into a format that can be stored (for example, in a file or memory buffer, or transmitted across a network connection link) and reconstructed later in the same or another computer environment.
Python 选择名称 pickle
因为它模仿了 Modula-3, where it was also called pickling. See Pickles: Why are they called that?