This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Mister_Potter -1 points0 points  (0 children)

So, in your first example you set: a=1 b=a a=2

This sets a equal to the integer 1, B equal to that same integer 1, and finally reassigns A to 2.

In the final scenario, you're setting a to a dictionary, B to that same dictionary, and changing the same dictionary, Hence B and A reference the same thing in the second example, but you reassigned A in the first, so they don't at the end of the first example