The Differences Between the Python List Shallow Copy & Deep Copy

In this video tutorial, I go over the semantics behind Python’s shallow and deep copy approaches to making copies of lists. I go over three (3) ways to create shallow copies of lists, demonstrating how a net-new list is created, but for the collection object types inside of the new list that they are actually just references/pointers to the exact same values of the original list. I then demonstrate the simple process of creating a ‘deep’ (read: recursive) copy of a Python list to ensure that your new list has 100% mutually exclusive and independent objects. I close by demonstrating how using the assignment operator ‘=’ is not creating either type of copy, but rather just a new reference/pointer to the original list. Enjoy!