Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Jan Durcak
12,662 Pointswhy is it working without copy.copy?
for _ in range(count): self.append(value)
1 Answer

Steven Parker
221,902 PointsIt's probably working because you're testing it with an immutable value
. Or it might just look like it's working because of how you use the created instance, particularly if you never change anything in it.
Ken explains this about 6 minutes into the video, when he says:
Now why am I using
copy.copy
? Well, if they send in something mutable, like say, another list, each member in that filled list or each member in our filled list that was a copy of that list would be the same member if we weren't usingcopy.copy
. If you changed one of them it would change all of the others too, because we're just putting in references to that list.