Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shallow copy question
#2
original[0].append(["marsupials"])
index[0] is the original list, so "marsupials" is appended to that.
to see this isolated, add after the append add:
print(original[0])
Reply


Messages In This Thread
Shallow copy question - by Calflo - Dec-01-2022, 05:09 PM
RE: Shallow copy question - by Larz60+ - Dec-01-2022, 07:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Why is the copy method name in python list copy and not `__copy__`? YouHoGeon 2 249 Apr-04-2024, 01:18 AM
Last Post: YouHoGeon

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020