liveBook · Manning

Pickle

Pickle is Python’s standard-library facility for serializing Python objects to byte streams and reconstructing them from those streams.

How 3 Manning books explain it

Python How-To

Pickling is Python's serialization process for converting objects into a byte stream that can be stored and later reconstructed.

How it is used
Preserves Python objects as binary data so costly processed data can be retrieved later.
How deep it goes
Works through file and bytes APIs, custom-instance restoration, compatibility limits, and a malicious-object example.
Examples
Uses task tuples and dictionaries, a custom Task instance, a function, and a malicious class.
What you can do after
Apply it via Python’s pickle module to save and restore objects while assessing compatibility and security risks.

Read how Python How-To explains pickle →

The Quick Python Book, Fourth Edition

pickle is a Python standard-library serialization facility for converting Python objects to and from a byte stream.

How it is used
Persists Python data structures and program state in binary files for later restoration.
How deep it goes
Explains byte-stream conversion, ordered dump/load calls, supported structures, and serialization limits without implementation internals.
Examples
Demonstrates serializing separate scalar values, restoring them, saving a dictionary, and maintaining a disk-backed calculation cache.
What you can do after
Apply pickle.dump and pickle.load to save and restore Python values through binary files.

Read how The Quick Python Book, Fourth Edition explains pickle →

Fast Python: High performance techniques for large datasets

How it is used
Carries Python data across process boundaries and in synchronous TCP requests.
How deep it goes
Shows serialization and reconstruction, then details multiprocessing limits including lambda failures and transfer overhead.
Examples
Uses a TCP client payload and a process-pool lambda failure to illustrate serialization in practice.
What you can do after
Apply pickle to move data through sockets or process pools, and recognize cases requiring separate handling.

Read how Fast Python: High performance techniques for large datasets explains pickle →

Also covered in

What to know first

Related concepts

Questions about pickle

What is pickle?

Pickle is Python’s standard-library facility for serializing Python objects to byte streams and reconstructing them from those streams.

Which Manning books explain pickle?

Python How-To, The Quick Python Book, Fourth Edition and Fast Python: High performance techniques for large datasets.

What should I know before learning pickle?

Manning books that teach pickle usually introduce Python, language model, JSON and malware first.

What is the difference between pickle and asyncpg Record?

Pickle is Python’s standard-library facility for serializing Python objects to byte streams and reconstructing them from those streams. An asyncpg Record is a row-like result object that provides column-value access using mapping and subscript operations.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.