What does it mean for an object to be picklable (or pickle-able)?

Viewed 44075

Python docs mention this word a lot and I want to know what it means! Googling doesn't help much..

4 Answers

These are all great answers, but for anyone who's new to programming and still confused here's the simple answer:

Pickling is making it so you can store it long term and get it later without it going bad. A bit like Saving in a video game.

So anything that's actively changing (like a live connection to a database) can't be stored directly (though you could probably figure out a way to store the information needed to create a new connection, and that you could pickle)

Bonus definition: Serializing is packaging it in a form that can be handed off to another program. Unserializing it is unpacking something you got sent so that you can use it

Pickling is the process in which the objects in python are converted into simple binary representation that can be used to write that object in a text file which can be stored. This is done to store the python objects and is also called as serialization. You can infer from this what de-serialization or unpickling means.

So when we say an object is picklable it means that the object can be serialized using the pickle module of python.

Related