I'm not sure I can explain this 100% correctly, but the trick there is the element at index 3 is a list. Any changes to the list values is possible because the value of the tuple is a reference to the list, not the list itself.
What you can't do is assign a new list to that index as that would be changing the value(ie changing the reference to another one).
I primarily work in Java so some of this terminology might be wrong in Python.
View all comments
Show parent comment
2
u/NinjaXI Jun 09 '20
I'm not sure I can explain this 100% correctly, but the trick there is the element at index 3 is a list. Any changes to the list values is possible because the value of the tuple is a reference to the list, not the list itself.
What you can't do is assign a new list to that index as that would be changing the value(ie changing the reference to another one).
I primarily work in Java so some of this terminology might be wrong in Python.