Assume
my_list = [[1], [2], [3], ["a"], [5]]
I want
my_imm = ImmutableList(mylist)
such that
my_imm[2][0] = 0
would either throw an error, or not change my_list[2]
.
Is there such a construct without copying all the data?
Also assume my_list
is long, and I wouldn't want a conversion, but rather an lazy iterator.
Notice this is not a duplicate of this, because I want THE ELEMENTS to be immutable.
Tuples won't solve that out of the box.