The question is pretty simple, suppose you have the following code:
a = (5,6,[7,8])
a[2] += [8]
It raises an exception as would be predicted, because tuples are immutable, but
print(a)
results in (5,6,[7,8,9])
I wanted to figure out what is going on behind the scenes.
Alternatively if you use extend
on a[2]
the exception is not thrown.