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 between program runs, especially when regenerating processed data would take time.
How deep it goes
Works through file and bytes operations, restoration checks, custom-class requirements, compatibility limits, and security risks without examining serialization internals.
Examples
Uses saved task tuples and dictionaries, a restored custom-class instance, a pickled function, and a malicious-object demonstration.
What you can do after
Apply it via Python’s pickle module to save and restore trusted objects, while recognizing unsupported objects and unsafe inputs.

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 →

Related concepts

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.