1 00:00:00,790 --> 00:00:03,190 The following content is provided under a Creative 2 00:00:03,190 --> 00:00:04,730 Commons license. 3 00:00:04,730 --> 00:00:07,030 Your support will help MIT OpenCourseWare 4 00:00:07,030 --> 00:00:11,390 continue to offer high-quality educational resources for free. 5 00:00:11,390 --> 00:00:13,990 To make a donation or view additional materials 6 00:00:13,990 --> 00:00:17,870 from hundreds of MIT courses, visit MIT OpenCourseWare 7 00:00:17,870 --> 00:00:18,830 at ocw.mit.edu. 8 00:00:22,244 --> 00:00:23,660 ANA BELL: All right, so let's see. 9 00:00:26,520 --> 00:00:31,170 So first we have L1 is equal to bacon, eggs. 10 00:00:31,170 --> 00:00:34,140 I'm going to short form-- shorthand this. 11 00:00:34,140 --> 00:00:39,750 L2 is equal to toast and jam. 12 00:00:39,750 --> 00:00:44,500 Brunch-- I should actually make these arrows-- brunch 13 00:00:44,500 --> 00:00:45,340 is equal to L1. 14 00:00:45,340 --> 00:00:47,200 So this is just aliasing, which means 15 00:00:47,200 --> 00:00:52,290 brunch is going to point to whatever L1 object points to. 16 00:00:52,290 --> 00:00:55,470 And if I do L1.append juice, L1 is now 17 00:00:55,470 --> 00:00:59,610 going to be bacon, eggs, and juice. 18 00:01:02,530 --> 00:01:03,720 OK? 19 00:01:03,720 --> 00:01:06,240 This L1 has been mutated to be that. 20 00:01:06,240 --> 00:01:08,610 And since brunch still points to the same object 21 00:01:08,610 --> 00:01:12,256 that L1 points to, brunch is now going to point to there. 22 00:01:12,256 --> 00:01:14,920 OK? 23 00:01:14,920 --> 00:01:17,380 So when I do brunch.extend L2, I'm 24 00:01:17,380 --> 00:01:22,724 going to take whatever brunch is, which is this part here, 25 00:01:22,724 --> 00:01:31,344 and I'm going to extend it by L2, which is toast and jam. 26 00:01:31,344 --> 00:01:32,140 OK? 27 00:01:32,140 --> 00:01:34,840 So it's just going to contain a large list of those five 28 00:01:34,840 --> 00:01:40,610 elements because of this side effect issue, where 29 00:01:40,610 --> 00:01:43,100 brunch was pointing to the same thing 30 00:01:43,100 --> 00:01:47,200 that L1 was pointing to, OK? 31 00:01:47,200 --> 00:01:51,430 So it's close, but I think-- perfect. 32 00:01:51,430 --> 00:01:54,450 Yes, that's the right answer.