Shallow Copy Vs Deep Copy in Python

preview_player
Показать описание
Demo Class:
Use Code: KN06
All Playlist In My channel

Please donate if you want to support the channel through GPay UPID,

Please join as a member in my channel to get additional benefits like materials in Data Science, live streaming for Members and many more

Please do subscribe my other channel too

Connect with me here:
Рекомендации по теме
Комментарии
Автор

I'm just a beginner to Python but still it was soo clear to me. Thank You for explaining it soo easily

asimgiri
Автор

Great Explanation now everything is clear, and we can also check reference no by using id(lst1) and id(lst2) it show the reference number. 🙂👍

helpingprogramming
Автор

Hello Krish, I think the whole concept relies on the following points.

= -> in 1d or 2d creates an object of the same memory location. Changes reflect

list.copy() in 1d -> copies the value into new object. Changes do not reflect
list.copy() in 2d -> copies the object in a object into new object. Changes reflect

copy.deepcopy and copy.copy() works for 2d only.

copy.deepcopy() -> Creates new object and inserts copy of the objects. Changes do not reflect
copy.copy() - > Creates new object and inserts the original objects. Changes reflect

In short, we need to see if we are putting copy/original objects.

zahidakitchentreats
Автор

I feel you could have shown visuals on the memory allocation for the nested lists part.

The whole point as I inferred from your video is that if you have a shallow copy it will allocate space in memory for two lists but the lists will be pointing to the same items, whereas if you do it with a deep copy then new objects will be created and that's why they will be independent like that. Am I right?

I just think you didn't stress this point as well as you could have.

ivansaiji
Автор

One tutor explained this for 1.5 Hr. Understood nothing.. This video is much much better than that's guy's boring explanation.. Very clear and very helpful.. Learnt the essence in this 12 minutes

saikrishnavadali
Автор

this 12 minutes is better than 2 hours lecturer

chillmathematician
Автор

Summary:
1a) Deep copy: multiple 1 to 1 relationships from variable to memory.
1b) Shallow Copy: many-to-one relationships from variables to memory.
2) In a normal list, shallow copy behaves as deep copy whereas in a nested list, shallow copy doesn't behave as deep copy.

Gayathri-ip
Автор

Sir can we call the copy (using assignment operator), a shallow copy

nikhilkothiyal
Автор

Thanks for the explanation..you really emphasised on the point it needed the most!

ascutecoupleslove
Автор

love uh this is the main concept which i wanna get thank uh thank uh soo much

malikhaider
Автор

Hi Krish your channel is very helpful for all DS aspirants like me. Request you to make a video on the system configurations needed for deep learning projects and is it better to buy system or assemble myself as buying a laptop is out of my budget. I am looking to buy a system for my deep.learning projects. Thank you

mayflowerlily
Автор

previous i just ignore this topic because i thought it was big and complicated but i understand how simple this.. Thank You Bro :-)

yogeerao
Автор

Thanks a lot bhai. ye shallow copy aur deepcopy ka concept hi smjh nai aa raha tha bht time se.

dashingagg
Автор

Great explanation, now I am clear with the topic of shallow and deep copy . Thank you so much 🙏

gurubalavigneshnatarajan
Автор

Sir, could you please do complete nosql course series from intermediate to advanced?

ZahidHasan-cctf
Автор

The explanation was vary clear. Thank you so much for your time.

mdhasnat
Автор

Thank you.. Your explanation is so clear and understandable

madhavithorvat
Автор

Thank you for explaining it so easily!

nocoTheGamer
Автор

Very nice explanation, I was confused but this video helps a lot! Thanks😊

adityamathur
Автор

print("Very well explained...")

sojwalgosavi