1

What is the math behind serialization and deserialization behind the dill and pickle libraries? Why dill can serialize/deserialization more objects than pickle?

I could not find the serialize/deserialization in their github repos: https://github.com/uqfoundation/dill/tree/master/dill https://github.com/python/cpython/blob/main/Lib/pickle.py

Thanks

Ngo Cuong
  • 63
  • 5
  • 2
    I'm the `dill` author. What do you mean "what is the math"? The difference is that `dill` essentially is built on top of `pickle`, where `dill` has registered a number of additional objects that it knows how to serialize/deserialize. You could do the same thing, in theory, by using the register function from `pickle`. – Mike McKerns Feb 15 '22 at 23:50
  • Thank you Mike for answering! I was wondering where in the dill repo I could find the serialization/deserialization functions (the process of converting a data object into a series of bytes that saves the state of the object in an easily transmittable form) of all data types supported by dill. The goal is just to understand better what dill does behind the scenes. – Ngo Cuong Feb 16 '22 at 07:09
  • Everything is in `dill/_dill.py`, for example here's how to convert a namedtuple: https://github.com/uqfoundation/dill/blob/1472ab567a95595399d553c90165ef1d1da2084c/dill/_dill.py#L974 – Mike McKerns Feb 16 '22 at 13:16

0 Answers0