I'm the dill
author. I'd generally use a .'pkl
extension instead of a .db
... but it's a pickle file. Essentially all of the objects in the notebook get serialized (converted to strings) and then stored in a file.
Serialization works like this:
>>> import dill
>>> class Foo(object):
... def __init__(self, x):
... self.x = x
... def bar(self, y):
... return self.x + y
...
>>> f = Foo(4)
>>> _f = dill.dumps(f)
>>> _f
b'\x80\x03cdill._dill\n_create_type\nq\x00(cdill._dill\n_load_type\nq\x01X\x04\x00\x00\x00typeq\x02\x85q\x03Rq\x04X\x03\x00\x00\x00Fooq\x05h\x01X\x06\x00\x00\x00objectq\x06\x85q\x07Rq\x08\x85q\t}q\n(X\n\x00\x00\x00__module__q\x0bX\x08\x00\x00\x00__main__q\x0cX\x08\x00\x00\x00__init__q\rcdill._dill\n_create_function\nq\x0e(cdill._dill\n_create_code\nq\x0f(K\x02K\x00K\x02K\x02KCC\n|\x01|\x00_\x00d\x00S\x00q\x10N\x85q\x11X\x01\x00\x00\x00xq\x12\x85q\x13X\x04\x00\x00\x00selfq\x14h\x12\x86q\x15X\x07\x00\x00\x00<stdin>q\x16h\rK\x02C\x02\x00\x01q\x17))tq\x18Rq\x19c__builtin__\n__main__\nh\rNN}q\x1aNtq\x1bRq\x1cX\x03\x00\x00\x00barq\x1dh\x0e(h\x0f(K\x02K\x00K\x02K\x02KCC\n|\x00j\x00|\x01\x17\x00S\x00q\x1eN\x85q\x1fh\x12\x85q h\x14X\x01\x00\x00\x00yq!\x86q"h\x16h\x1dK\x04C\x02\x00\x01q#))tq$Rq%c__builtin__\n__main__\nh\x1dNN}q&Ntq\'Rq(X\x07\x00\x00\x00__doc__q)NX\r\x00\x00\x00__slotnames__q*]q+utq,Rq-)\x81q.}q/h\x12K\x04sb.'
>>> del f
>>> del Foo
>>> f = dill.loads(_f)
>>> f.bar(3)
7
>>>
Where, for simple objects, you can start to see how the unique encoding of the object into a string works. For example, it's easy to pick out what corresponds to the integers contained in the sequences below, and that serializing a tuple gives a slightly different string than does a list.
>>> dill.dumps([1,2,3])
b'\x80\x03]q\x00(K\x01K\x02K\x03e.'
>>> dill.dumps([1,2,3,4,5])
b'\x80\x03]q\x00(K\x01K\x02K\x03K\x04K\x05e.'
>>> dill.dumps((1,2,3,4,5))
b'\x80\x03(K\x01K\x02K\x03K\x04K\x05tq\x00.'
>>>