From the course: Effective Serialization with Python

Why do we need serialization? - Python Tutorial

From the course: Effective Serialization with Python

Why do we need serialization?

- [Instructor] Serialization is the act of taking Python objects, such as dict list, daytime and others, and converting them to a sequence of bytes. On the other side, there's de-serialization, we'll take a sequence of bytes and convert them to a Python objects or several objects. The fist question people ask is why, why do we need to do that? The answer is that internally computer knows only about bits of zeros and ones to help us humans, we divided these bits into groups of eight and call them bytes. The Python interpreter, obstruct this for you and let you work at the higher level thinking of sets, lists, strings, and other data types. However, when you need to transfer or store data, it must be converted to a sequence of bytes. The second question is how, how can you convert an object such as a Python list to a sequence of bytes? There are many answers to these questions. These answers have names such as JSON, YAML, PICKLE, XML, and more. Each of these names is the name of a serialization format. There are many serialization formats out there and we'll discuss the pros and cons of some of the major ones throughout this course. Serialization is usually done at the edges of your program. When you receive data from a socket, write to a file, create a database, et cetera. Inside your program, you will work with high level Python objects. The usual workflow is this serialized bytes to Python object or objects from the input work with Python objects and finally serialize Python, object or objects into bytes to Dell.

Contents