Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6596117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:01:57+00:00 2026-05-25T18:01:57+00:00

If I have objects a and b and both reference object obj , what

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:01:58+00:00Added an answer on May 25, 2026 at 6:01 pm

    Yes, shared objects will only get serialized once (the pickle protocol can even handle circular references).

    From the documentation:

    The pickle module keeps track of the objects it has already
    serialized, so that later references to the same object won’t be
    serialized again. marshal doesn’t do this.

    This has implications both for recursive objects and object sharing.
    Recursive objects are objects that contain references to themselves.
    These are not handled by marshal, and in fact, attempting to marshal
    recursive objects will crash your Python interpreter. Object sharing
    happens when there are multiple references to the same object in
    different places in the object hierarchy being serialized. pickle
    stores such objects only once, and ensures that all other references
    point to the master copy. Shared objects remain shared, which can be
    very important for mutable objects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have C++ objects that I can read/write in both C++ &
I have Exhibit objects which reference Gallery objects both of which are stored in
I have 2 objects, both of which I want to convert to dictionarys. I
I have two UIImageView objects inside my view (both 320x480 one above the other).
I have an array of custom class Student objects. CourseStudent and ResearchStudent both inherit
We have objects that we want to represent in stacks (think of stacking items
I have objects with many variables that I declare and explain in the comments.
I have objects with location data stored in Core Data, I would like to
I have objects that has a DateTime property, how can i query for the
As we know, C# objects have a pointer to their type, so when you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.