Comment on (In Python) Can you save an object that is in memory to disk and reload it at a later time?

jerkface@lemmy.ca ⁨2⁩ ⁨weeks⁩ ago

I took a closer look at what you are asking for and no, you cannot hand a reference to a python structure to a library and have it write the binary data from memory out to disk, then read that same binary data back into living Python instances later. That’s just not how Python works. For one thing, any such structure is full of pointers which would be invalid unless you re-load to the same address in memory, which is not practical. You have to serialize and de-serialize.

source
Sort:hotnewtop