wtfpython icon indicating copy to clipboard operation
wtfpython copied to clipboard

Example1

Open Yukti-09 opened this issue 5 years ago • 3 comments

a=[11,22] b=a The ids of the two will be the same. Now, a[0]=1 The ids of the two will still be the same as both a and b are referring to the same location, changes made to a are made to b as well. Hence, a=[1,22] b=[1,22]

Now if we do import copy c=copy.deepcopy(a) id(a) will not be equal to id(c)

Yukti-09 avatar Oct 17 '19 15:10 Yukti-09

This concept has already been covered in tic-tac-toe example.

satwikkansal avatar Oct 29 '19 14:10 satwikkansal

Let me know if I've missed anything?

satwikkansal avatar Oct 29 '19 14:10 satwikkansal

deepcopy has not been used explicitly.

Yukti-09 avatar Nov 09 '19 10:11 Yukti-09