How To Copy Lists In Python - Shallow Copy vs Deep Copy

preview_player
Показать описание
How to copy variables in Python? What's the difference between shallow copy and deep copy in Python? These seemingly simple questions require a proper deep dive into the workings of Python to actually answer precisely. Turns out mutability plays a huge role in how we copy objects in Python. Learn the difference between shallow copying and deep copying and when to use each of these methods in your code. After watching this video, you'll have a proper understanding on how variables are handled in Python and how to copy a given object depending on its mutability and on its "depth".

🚀 If you'd like to support my channel, you can do so either as:

Don't forget to like, if you want to learn even MORE Python!

00:00 Copying Variables
00:42 Equal Sign
03:58 Shallow Copy
05:48 Nested Structures
08:30 Deep Copy
11:05 Recap & Final Thoughts

#python #pythonprogramming #pythontutorial #shallowcopy #deepcopy #variablesinpython #pythonlist
Рекомендации по теме
Комментарии
Автор

Very nice and clear way of explanation …visualizations helps a lot to understand the concepts easily..keep up the good work..

Seamonster
Автор

I love how you clearly explain the concepts. You made it very easy to follow along. You must be putting a lot of effort into these videos. This topic is a major blind spot that i never would have known about unless told. Thank you so much.

ttrev
Автор

This video is just as amazing as previous one

Hoping that you create more videos thanks Sir ❤

informativecontent
Автор

Thank you so much for this video ! The memory animation helped me A LOT to visualize and understand the difference between shallow copy and deep copy. Impatiently wating for your next video, keep it up 🚀

joannamoussajm
Автор

Excellent video! Very clear explanations!👌

loatfreak
Автор

Another very good video! Im sure I'll use deep copy quite a bit in future

JohanildPG
Автор

Awesome video!
I didn’t know that lists all in python were linked lists (as it seems to be in your video). I thought lists in python keep each element close to each other in memory, like an array, which in turn would make index and access to their elements much faster.

allanatal
Автор

Great content, thank you for sharing!!

lazy-mmlj