🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Python Intermediate

What is Pickle?

Python's built-in module for serializing and deserializing Python objects into a byte stream for storage or transmission.

Pickle converts Python objects (lists, dictionaries, classes, machine learning models) to bytes and back. Usage: pickle.dump(obj, file) to save, pickle.load(file) to restore. It handles complex object graphs including circular references.

Security warning: Never unpickle data from untrusted sources — it can execute arbitrary code. For safe serialization, use JSON (simple types), MessagePack, or Protocol Buffers. Pickle is useful for caching, ML model storage, and inter-process communication.

Related Terms

Python Package
A directory containing Python modules and an __init__.py file, providing a way to organize and distribute reusable code.
List Comprehension
A concise syntax for creating new lists by applying an expression to each item in an existing iterable.
Python Descriptors
Objects that define __get__, __set__, or __delete__ methods, controlling how attribute access works on other objects.
Poetry
A modern Python dependency management and packaging tool that handles virtual environments, locking, and publishing.
Slots
A class mechanism that restricts attribute creation and reduces memory usage by using a fixed set of instance variables.
FastAPI
A modern, high-performance Python web framework for building APIs with automatic OpenAPI documentation and type validation.
View All Python Terms →