using
LIST.copy()
not work
it copy (make a new obj) only of the “container” , but if inside the list there other list ?
what i mean :
>>> L=[[[1,2,3]]]
>>> L2=L.copy()
>>> L2[0][0] = “ww”
>>> L
[[‘ww’]] # bad!
i want istead that L2 is a new container, that copy all … something as (the syntax is invented):
>>> L=[[[1,2,3]]]
>>> L2=L.superCopy()
>>> L2[0][0] = “ww”
>>> L
[[[1,2,3]]]
is possible ? or is necessary make it manually (item by item) ?
this is the piece of code that give issue, solved “manually”
else:
if lenL < 10 :
if random.random() > 0.5 :
cop = L[int(lenL * random.random())].copy()
cop2 = [cop[0].copy(), cop[1].copy() ] #<<<< line redundant and prone to bug
L.append( cop2 ) #????