If I have objects a and b and both reference object obj, what happens when I Pickle and then restore the objects? Will the pickled data ‘know’ that a and b both referenced the same object and restore everything accordingly, or will the two get two different — and initially equal — objects?
If I have objects a and b and both reference object obj , what
Share
Yes, shared objects will only get serialized once (the pickle protocol can even handle circular references).
From the documentation: