I understand since tuples are immutable, they are typically stored in contiguous memory blocks for efficiency. But I would like to understand how tuples are stored when elements are mutable e.g. list.
Concretely, I can create a tuple with a list as element and then add to this list. How is tuple stored in memory in this case? Is it just storing reference? If so, how does it decide to store reference vs value?
t = (1,2,[])
t[2].append(3)
print(t)
# (1, 2, [3])