1 00:00:07,190 --> 00:00:12,240 So, you might wonder why are we making such a big deal out of 2 00:00:12,240 --> 00:00:17,010 whether a and b point to the same object or two objects that are equivalent? 3 00:00:17,010 --> 00:00:20,720 The answer is that, when they are aliases for each other, 4 00:00:20,720 --> 00:00:22,550 when they point to the same object, 5 00:00:22,550 --> 00:00:26,519 things can get pretty confusing because when you change one of the objects, 6 00:00:26,519 --> 00:00:28,530 you've changed the other one too. 7 00:00:28,530 --> 00:00:32,385 So, let's just see how that works out. 8 00:00:32,385 --> 00:00:40,485 On line one, so the variable a is bound to the list 81, 82, 9 00:00:40,485 --> 00:00:49,750 83 and b is bound to an equivalent list, 10 00:00:50,570 --> 00:00:53,890 but not the same one. 11 00:00:56,900 --> 00:00:59,475 So, when we get to line three, 12 00:00:59,475 --> 00:01:04,629 it says print a as b the answer is false. 13 00:01:05,870 --> 00:01:08,430 Now, on line five, 14 00:01:08,430 --> 00:01:12,495 we're going to make b and a be aliases for each other. 15 00:01:12,495 --> 00:01:15,955 They weren't before, but now they are. 16 00:01:15,955 --> 00:01:20,000 So, b is no longer going to be bound to that one, 17 00:01:20,000 --> 00:01:23,125 it's going to be bound to the thing that a is bound to. 18 00:01:23,125 --> 00:01:29,885 Now, a is equivalent to b, 19 00:01:29,885 --> 00:01:37,180 but we also have that a and b are bound to the very same object. 20 00:01:38,570 --> 00:01:44,640 If we then set b square bracket zero to equal five, 21 00:01:44,640 --> 00:01:46,410 well this is position zero, 22 00:01:46,410 --> 00:01:49,035 position one, position two. 23 00:01:49,035 --> 00:01:56,144 If we set b square bracket zero to now have the value five, 24 00:01:56,144 --> 00:02:05,490 and then we go to print a, 25 00:02:05,490 --> 00:02:13,485 we're going to get five, 82, 83. 26 00:02:13,485 --> 00:02:17,150 The reason I say this is confusing is if you look at 27 00:02:17,150 --> 00:02:20,525 this code from the top to the bottom, 28 00:02:20,525 --> 00:02:23,749 we set a to be 81, 82, 29 00:02:23,749 --> 00:02:28,775 and 83, we never change a again. 30 00:02:28,775 --> 00:02:33,455 There's no assignment statement to a anywhere in here. 31 00:02:33,455 --> 00:02:37,235 Then we go print it, and it's different. 32 00:02:37,235 --> 00:02:42,140 Now in this code, a and b they're all pretty close to each other. 33 00:02:42,140 --> 00:02:43,670 We can figure out what's going on. 34 00:02:43,670 --> 00:02:47,944 But you can imagine a much bigger program where you have a variable, 35 00:02:47,944 --> 00:02:50,485 and somewhere else in the code, 36 00:02:50,485 --> 00:02:56,375 some other alias for that variable causes the item do mutated to change, 37 00:02:56,375 --> 00:02:58,580 and you have no idea why it's happening. 38 00:02:58,580 --> 00:03:05,240 So, that's why I say aliasing and mutable objects can create some confusions. 39 00:03:05,240 --> 00:03:09,780 Be on the lookout for that. See you next time.