So, you might wonder why are we making such a big deal out of
whether a and b point to the same object or two objects that are equivalent?
The answer is that, when they are aliases for each other,
when they point to the same object,
things can get pretty confusing because when you change one of the objects,
you've changed the other one too.
So, let's just see how that works out.
On line one, so the variable a is bound to the list 81, 82,
83 and b is bound to an equivalent list,
but not the same one.
So, when we get to line three,
it says print a as b the answer is false.
Now, on line five,
we're going to make b and a be aliases for each other.
They weren't before, but now they are.
So, b is no longer going to be bound to that one,
it's going to be bound to the thing that a is bound to.
Now, a is equivalent to b,
but we also have that a and b are bound to the very same object.
If we then set b square bracket zero to equal five,
well this is position zero,
position one, position two.
If we set b square bracket zero to now have the value five,
and then we go to print a,
we're going to get five, 82, 83.
The reason I say this is confusing is if you look at
this code from the top to the bottom,
we set a to be 81, 82,
and 83, we never change a again.
There's no assignment statement to a anywhere in here.
Then we go print it, and it's different.
Now in this code, a and b they're all pretty close to each other.
We can figure out what's going on.
But you can imagine a much bigger program where you have a variable,
and somewhere else in the code,
some other alias for that variable causes the item do mutated to change,
and you have no idea why it's happening.
So, that's why I say aliasing and mutable objects can create some confusions.
Be on the lookout for that. See you next time.