Shallow vs. deep copies
Channel: Alexander Hess - Pythonista
Date: 2021-02-16

In this video, I explain the difference between shallow and deep copies with the example of a nested list object. Shallow copies simply copy the references inside a container objects whereas deep copies also follow the references recursively and duplicate an entire data structure in memory. Shallow copies take a lot less memory but will lead to semantic errors in a program when the data inside the copied object are changed after the copy. As both the original and the shallow copy share the same referenced objects, changing these via one of the two makes the changes also visible via the other!

PYTHON BOOK
The lecture is based on the free book "Introduction to Python & Programming".
Get it on GitHub: https://github.com/webartifex/intro-to-python

SUBSCRIBE
If you like the way I teach and talk about programming and data science, subscribe to this channel.
The videos focus on coding courses and tutorials aimed at managers and students of business administration, enabling them to make better decisions with analyses done in code.

INSTRUCTOR
Alexander Hess, PhD Student
WHU - Otto Beisheim School of Management, Vallendar, Germany 

CONTACT
GitHub: https://github.com/webartifex
LinkedIn: https://linkedin.com/in/webartifex
XING: https://xing.to/webartifex
Facebook: https://facebook.com/webartifex
Instagram: https://instagram.com/webartifex
Website: http://www.webartifex.biz
YouTube: https://youtube.com/user/webartifex

wa-vid-063