fork download
  1. #!/usr/bin/python3
  2.  
  3. import copy
  4.  
  5. class tmp:
  6. def __init__(self,a):
  7. self.a=a
  8.  
  9. t1 = tmp([1,2,3])
  10. t2 = tmp([4,5,6])
  11. t1=copy.deepcopy(t2)
  12. t1.a[0]=0
  13. t2.a[1]=0
  14. print(t1.a)
  15. print(t2.a)
Success #stdin #stdout 0.01s 10296KB
stdin
Standard input is empty
stdout
[0, 5, 6]
[4, 0, 6]