# Two discussions of copying mutable objects in episode 3?#616

Open
opened this issue Jan 31, 2019 · 1 comment
Open

# Two discussions of copying mutable objects in episode 3? #616

opened this issue Jan 31, 2019 · 1 comment

### edbennett commented Jan 31, 2019

 I was tripped up teaching this week when working through episode 3—there's a long sidebar talking about mutability, most of which is devoted to showing how to make copies of lists without accidental aliasing. Then a few paragraphs later, there's an almost identical discussion of avoiding this problem, with a different example, and avoiding the word mutable. Having not noticed this beforehand, I ended up repeating myself largely, since I assumed that there would be something new to say, and then there wasn't. Should these two sections be consolidated into one discussion? (Perhaps by removing "how to correctly create copies" from the sidebar, and mentioning that it will be discussed further down the page?) Removing some duplicated content would also go a (very small) way towards helping with the time constraints with this long lesson. The text was updated successfully, but these errors were encountered:

### AnthonyOfSeattle commented Jul 12, 2019

 I second this idea. I'm very fond of teaching the difference between copying and just assigning a list to a new variable name. Especially since it seems like something previous users of R could get caught on, where its less of an issue. However, Ch-Ch-Ch-Ch-Changes does seem like it can be split up. Maybe we could try something like this? Move the first two paragraphs of Ch-Ch-Ch-Ch-Changes, which talk about mutability, to be part of the standard lesson right after ``````name = 'Darwin' name[0] = 'd' `````` Drop the salsa example of Ch-Ch-Ch-Ch-Changes. I think it is a nice example but seems to be a lot of typing to get the premise across. Add an assignment example to the mutability section at the bottom of the lesson ``````odds = [1, 3, 5, 7, 9] primes = odds primes[-1] = 11 print('primes:', primes) print('odds:', odds) `````` ``````primes.append(2) print('primes:', primes) print('odds:', odds) ``````