Pickle
Pickle is Python’s standard-library facility for serializing Python objects to byte streams and reconstructing them from those streams.
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.
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
- byte streamproduces · A byte stream is an ordered flow of bytes representing binary data for storage, processing, transmission, or incremental reading without inherent message semantics.
- multiprocessingused by · Multiprocessing is a programming technique that executes work in multiple operating-system processes, enabling concurrent or parallel execution across available processor resources.
- JSONcontrasts with · JSON is a standardized, language-independent text format for representing structured data using objects, arrays, strings, numbers, Boolean values, and null.
- lambdacontrasts with · A lambda is a language construct that defines an unnamed function or callable, often as a value.
- cachingused by · Caching is the practice of storing reusable data or computation results so later access can avoid repeating retrieval or computation.
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.


