From 5ce9c8a445c60f3f1da21bd340ab99857d3f0a31 Mon Sep 17 00:00:00 2001 From: Gordon Senesac Jr Date: Thu, 22 Oct 2015 20:22:57 -0500 Subject: [PATCH] Added serialization.rst file to scenarios. --- docs/scenarios/serialization.rst | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 docs/scenarios/serialization.rst diff --git a/docs/scenarios/serialization.rst b/docs/scenarios/serialization.rst new file mode 100644 index 000000000..ac0494f14 --- /dev/null +++ b/docs/scenarios/serialization.rst @@ -0,0 +1,40 @@ +================== +Data Serialization +================== + +What is data serialization? +--------------------------- + +Data serialization is the concept of converting structured data into a format +that allows it to be shared or stored in such a way that its original +structure to be recovered. In some cases, the secondary intention of data +serialization is to minimize the size of the serialized data which then +minimizes disk space or bandwidth requirements. + +Pickle +------ + +The native data serialization module for Python is called `Pickle +`_. + +Here's an example: + +.. code-block:: python + + import pickle + + #Here's an example dict + grades = { 'Alice': 89, 'Bob': 72, 'Charles': 87 } + + #Use dumps to convert the object to a serialized string + serial_grades = pickle.dumps( grades ) + + #Use loads to de-serialize an object + received_grades = pickle.loads( serial_grades ) + +Protobuf +-------- + +If you're looking for a serialization module that has support in multiple +languages, Google's `Protobuf +`_ library is an option.