3
From list m
:
m = [[' # ', ' # ', ' # ', ' # ', ' # ', ' # '], [' # ', ' # ', ' # ', ' # ', ' # ', ' # '], [' # ', ' # ', ' # ', ' # ', ' # ', ' # '], [' # ', ' # ', ' # ', ' # ', ' # ', ' # '], [' # ', ' # ', ' # ', ' # ', ' # ', ' # '], [' # ', ' # ', ' # ', ' # ', ' # ', ' # ']]
In doing mb = m[:]
or mb = list(m)
I would clone the m
initial, right or not? But in doing mb[0][0] = 99999999
, for example, the list m
is also modified.
What I’m not seeing or don’t know about it?
It will have the same problem as the other answer, which was deleted. What it has is a list of lists, which are mutable types. Even making the copy shallow, with
copy
, the references of the internal objects will remain in the new list. If one of them is changed, the change will be reflected in the original. See: https://repl.it/@acwoss/Disfiguredstrictbase– Woss