Shallow Copy Vs Deep Copy in Python

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ก.ย. 2024

ความคิดเห็น • 85

  • @helpingprogramming134
    @helpingprogramming134 3 ปีที่แล้ว +12

    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. 🙂👍

  • @asimgiri4269
    @asimgiri4269 3 ปีที่แล้ว +12

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

  • @zahidakitchentreats9719
    @zahidakitchentreats9719 3 ปีที่แล้ว +9

    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.

  • @saikrishnavadali05
    @saikrishnavadali05 3 ปีที่แล้ว +1

    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

  • @Sarah-re7cg
    @Sarah-re7cg 3 วันที่ผ่านมา

    This was very clear and concise, thank you so much!

  • @Negi171
    @Negi171 หลายเดือนก่อน

    This is what I understand :
    (If we create a nested list and make a shallow copy of it , and then we change the original list then the shallow copy list will not be changed but if we change the object that is inside the original list's list that is referring to the shallow copy then the change will also be reflected in shallow copy )

  • @Ivan_e9812
    @Ivan_e9812 3 ปีที่แล้ว +11

    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.

    • @DhavalAhir10
      @DhavalAhir10 ปีที่แล้ว

      In Python 1000 Same List Create 1000 new Memory location... Python can't take risk with mutable objects.

  • @ascutecoupleslove
    @ascutecoupleslove หลายเดือนก่อน

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

  • @dhairyadaga1725
    @dhairyadaga1725 3 ปีที่แล้ว +2

    Simple and Clear to the point .

  • @chillmathematician3303
    @chillmathematician3303 3 ปีที่แล้ว +18

    this 12 minutes is better than 2 hours lecturer

  • @gurubalavigneshnatarajan3817
    @gurubalavigneshnatarajan3817 7 หลายเดือนก่อน

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

  • @yogeerao9149
    @yogeerao9149 ปีที่แล้ว

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

  • @dashingagg1
    @dashingagg1 2 ปีที่แล้ว

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

  • @malikhaider9084
    @malikhaider9084 หลายเดือนก่อน

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

  • @madhavithorvat6803
    @madhavithorvat6803 4 หลายเดือนก่อน

    Thank you.. Your explanation is so clear and understandable

  • @mdhasnat8395
    @mdhasnat8395 ปีที่แล้ว

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

  • @noco04TheGamer
    @noco04TheGamer ปีที่แล้ว

    Thank you for explaining it so easily!

  • @ShubhamKumar-xt3vi
    @ShubhamKumar-xt3vi ปีที่แล้ว

    You made it very easy to understand.

  • @Gayathri-i5p
    @Gayathri-i5p 2 หลายเดือนก่อน

    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.

  • @bhaskarg8438
    @bhaskarg8438 3 ปีที่แล้ว

    Your are Great !! helping the community

  • @mayflowerlily5326
    @mayflowerlily5326 3 ปีที่แล้ว +1

    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

  • @raneshmitra8156
    @raneshmitra8156 3 ปีที่แล้ว

    Fabulous explanation of a very complicated topic of Python....

  • @235orel
    @235orel 2 ปีที่แล้ว

    Very helpful and clear! thanks!!

  • @adityamathur2284
    @adityamathur2284 3 ปีที่แล้ว

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

  • @shailajadavangave45
    @shailajadavangave45 ปีที่แล้ว

    Thank you so much well easily explaiend

  • @ZahidHasan-cc8tf
    @ZahidHasan-cc8tf 3 ปีที่แล้ว +3

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

  • @sojwalgosavi4406
    @sojwalgosavi4406 2 ปีที่แล้ว +1

    print("Very well explained...")

  • @osmanmerdan1169
    @osmanmerdan1169 2 ปีที่แล้ว

    Thank s for this great explaination

  • @kunchalaharikrishna6316
    @kunchalaharikrishna6316 ปีที่แล้ว

    👏👏TYSM

  • @anchalpatel10
    @anchalpatel10 2 ปีที่แล้ว +1

    well explained!!

  • @nikhilkothiyal
    @nikhilkothiyal 5 หลายเดือนก่อน +1

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

  • @awkashi
    @awkashi ปีที่แล้ว

    so helpful and clear! thank you :)

  • @carforyou6573
    @carforyou6573 3 ปีที่แล้ว +1

    thank you, sir

  • @mohseneb.6263
    @mohseneb.6263 2 ปีที่แล้ว

    So Helpful!

  • @faizanwar_
    @faizanwar_ 2 ปีที่แล้ว

    Very well explanated

  • @ezzsnippet125
    @ezzsnippet125 2 หลายเดือนก่อน

    Nice explanation sir

  • @user-he8jx6ci8x
    @user-he8jx6ci8x 2 ปีที่แล้ว

    Thank you so much this was a very good explanation

  • @hakimeghaffari7889
    @hakimeghaffari7889 3 ปีที่แล้ว

    Very well explained. Thank you...

  • @devrajbhattacharya7912
    @devrajbhattacharya7912 2 ปีที่แล้ว

    THANKS A LOT SIR

  • @helpingnextgeneration
    @helpingnextgeneration 3 ปีที่แล้ว

    Thank you so much!
    Very well explained

  • @riz_ahmeds
    @riz_ahmeds 2 หลายเดือนก่อน

    Really helpful,

  • @samialvi4226
    @samialvi4226 2 ปีที่แล้ว

    Great explanation
    Thanks

  • @ranvirpoddar6710
    @ranvirpoddar6710 2 ปีที่แล้ว

    Thank you so much, you saved me several hours 🤗

  • @gtsui87
    @gtsui87 2 ปีที่แล้ว

    This was a great explanation it was very clear. However, is it possible to add an example of when you would use either shallow copy or deep copy. I'm not sure when these things would get used.

    • @mohammadazad8350
      @mohammadazad8350 ปีที่แล้ว

      I had a nested list which I wanted to copy using "=" and it didn't work, so deep copy is useful, however I can also make a loop that does the same thing

  • @shadow_self8564
    @shadow_self8564 3 ปีที่แล้ว

    Thanks a lot!

  • @yuvarajpanneerselvam7644
    @yuvarajpanneerselvam7644 ปีที่แล้ว

    i ma mechanical engineer but watching this i can clearly understand excellent way of teaching

  • @abdelrhmandameen2215
    @abdelrhmandameen2215 3 ปีที่แล้ว

    Great explanation. Thanks.

  • @diegobarrientos6271
    @diegobarrientos6271 3 ปีที่แล้ว

    thanks!, very clear explanation

  • @AshisRaj
    @AshisRaj 2 ปีที่แล้ว

    Excellent explanation

  • @darshanapatil9218
    @darshanapatil9218 3 ปีที่แล้ว

    excellent explanation!!!

  • @vrindavaneshwari_ju_ki_kripa
    @vrindavaneshwari_ju_ki_kripa 3 ปีที่แล้ว

    Ty bhaiya

  • @kolla_teja
    @kolla_teja 3 ปีที่แล้ว

    very great series thank you sir

  • @tiberius1921
    @tiberius1921 3 ปีที่แล้ว

    Спасибо!

  • @soumyaranjansethi1790
    @soumyaranjansethi1790 3 ปีที่แล้ว

    Amazing thank you

  • @rohitpant6473
    @rohitpant6473 2 ปีที่แล้ว

    keep it up

  • @puspitasahoo3420
    @puspitasahoo3420 2 ปีที่แล้ว +1

    7:23

  • @abcdeftanutanu2187
    @abcdeftanutanu2187 2 ปีที่แล้ว

    nice

  • @-Me-yl2ou
    @-Me-yl2ou 3 ปีที่แล้ว

    Started learning python today ✌️

  • @tejasj5485
    @tejasj5485 3 หลายเดือนก่อน

    concept ok. but whats the use of it ?

  • @NandWebDev
    @NandWebDev 3 ปีที่แล้ว

    Sir plz do a multithread concepts in python

  • @mayursai7220
    @mayursai7220 3 ปีที่แล้ว

    Bro please explain how to change my career path into cloud computing
    Currently i am working as uxdesigner
    Please do a video on that 🙏🙏

  • @sanjayjattinagoudar2481
    @sanjayjattinagoudar2481 3 ปีที่แล้ว

    @Krish Too may ads in the vedio is spoiling the flow

  • @akhilsartnation9262
    @akhilsartnation9262 3 ปีที่แล้ว

    maza aagaya bhai

  • @surajprajapati3447
    @surajprajapati3447 3 ปีที่แล้ว

    Sir can you make video on business analytics

  • @ravimody5536
    @ravimody5536 ปีที่แล้ว

    Does this even apply to dataframes?

  • @chetanmarane2514
    @chetanmarane2514 2 ปีที่แล้ว

    What is difference between deep copy and =

    • @malikhaider9084
      @malikhaider9084 หลายเดือนก่อน

      (=) simply referred the memory location
      (copy) make a new memory of item but

  • @dineshkannan7580
    @dineshkannan7580 3 ปีที่แล้ว

    Can I use .copy(deep=True) for deep copy

  • @manishsrivastav4897
    @manishsrivastav4897 2 ปีที่แล้ว

    bhai jo jis doubt ko le k aaega wo waisa ka waisa he reh jaega iss video me

  • @nishanthgajjala5282
    @nishanthgajjala5282 3 ปีที่แล้ว

    Hello Sir, if we want to reach out for you how do we reach

  • @mohammadazad8350
    @mohammadazad8350 ปีที่แล้ว

    I always thought python had "deep copy" set by default since it worked with non iterables but then I encountered a strange bug which brought me here

  • @cagataytekin6372
    @cagataytekin6372 10 หลายเดือนก่อน

    buyuksun hoca

  • @tashinahamed7822
    @tashinahamed7822 3 ปีที่แล้ว

    I've blundered 3 hours why list have changed automatically before watching this video

  • @nandinikose1414
    @nandinikose1414 2 ปีที่แล้ว

    👾😁👍

  • @surendra_tarai
    @surendra_tarai ปีที่แล้ว

    It can be explained in better way.

  • @sudharsanb9391
    @sudharsanb9391 3 ปีที่แล้ว +2

    First

  • @AbhishekJha-wm5oq
    @AbhishekJha-wm5oq 2 ปีที่แล้ว

    Full confused

  • @puspitasahoo3420
    @puspitasahoo3420 2 ปีที่แล้ว

    8:58