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 7788421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:59:41+00:00 2026-06-01T20:59:41+00:00

I see a article about the immutable object. It says when: variable = immutable

  • 0

I see a article about the immutable object.

It says when:
variable = immutable
As assign the immutable to a variable.

for example
a = b # b is a immutable
It says in this case a refers to a copy of b, not reference to b.
If b is mutable, the a wiil be a reference to b

so:

a = 10
b = a
a =20
print (b) #b still is 10

but in this case:

a = 10
b = 10
a is b # return True
print id(10)
print id(a)
print id(b) # id(a) == id(b) == id(10)

if a is the copy of 10, and b is also the copy of 10, why id(a) == id(b) == id(10)?

  • 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-06-01T20:59:44+00:00Added an answer on June 1, 2026 at 8:59 pm

    While that article may be correct for some languages, it’s wrong for Python.

    When you do any normal assignment in Python:

    some_name = some_name_or_object
    

    You aren’t making a copy of anything. You’re just pointing the name at the object on the right side of the assignment.

    Mutability is irrelevant.

    More specifically, the reason:

    a = 10
    b = 10
    a is b
    

    is True, is that 10 is interned — meaning Python keeps one 10 in memory, and anything that is set to 10 points to that same 10.

    If you do

    a = object()
    b = object()
    a is b
    

    You’ll get False, but

    a = object()
    b = a
    a is b
    

    will still be True.

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

Sidebar

Related Questions

From this article on CodeGuru about PayPal IPN, I see there are two fields,
i have see this article about retrieve memory usage off iphone app programmatically-retrieve-memory-usage-on-iphone It's
Is the Wikipedia example at this article about method overiding in C++ correct? Please
I found this on net in google search and see article here: http://www.thatcssguy.com/limit-your-divs/ See
First let me say that I did see this article: How to remove AspxAutoDetectCookieSupport
After reading this article about two different types of regular expression algorithms (Perl 5.8.7
I just read an interesting article about php hanging on certain float numbers, see
I was reading this article about volatile fields in C#. using System; using System.Threading;
I have been reading an article about Lockless Programming in MSDN. It says :
After reading this article about validating with service layer I have some doubts. First:

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.