both dump methods accept an optional protocol argument if we are saving and loading pickled objects that are only going to be used in python programswe don' need to supply this argument unfortunatelyif we are storing objects that may be loaded by older versions of pythonwe have to use an older and less efficient protocol this should not normally be an issue usuallythe only program that would load pickled object would be the same one that stored it pickle is an unsafe formatso we don' want to be sending it unsecured over the internet to unknown interpreters the argument supplied is an integer version number the default version is number representing the current highly efficient storage system used by python pickling the number is the older versionwhich will store an object that can be loaded on all interpreters back to python as is the oldest of python that is still widely used in the wildversion pickling is normally sufficient versions and are supported on older interpreters is an ascii formatwhile is binary format there is also an optimized version that may one day become the default as rule of thumbthenif you know that the objects you are pickling will only be loaded by python program (for exampleonly your program will be loading them)use the default pickling protocol if they may be loaded by unknown interpreterspass protocol value of unless you really believe they may need to be loaded by an archaic version of python if we do pass protocol to dump or dumpswe should use keyword argument to specify itpickle dumps(my_objectprotocol= this is not strictly necessaryas the method only accepts two argumentsbut typing out the full keyword argument reminds readers of our code what the purpose of the number is having random integer in the method call would be hard to read two whatstore two copies of the objectmayberemembercode should always be readable in pythonless code is often more readable than longer codebut not always be explicit it is possible to call dump or load on single open file more than once each call to dump will store single object (plus any objects it is composed of or contains)while call to load will load and return just one object so for single fileeach separate call to dump when storing the object should have an associated call to load when restoring at later date customizing pickles with most common python objectspickling "just worksbasic primitives such as integersfloatsand strings can be pickledas can any container objectsuch as lists or dictionariesprovided the contents of those containers are also picklable furtherand importantlyany object can be pickledso long as all of its attributes are also picklable