A colleague just posted this Python execution:
>>> a = ([0, 1, 2], None)
>>> a[0] += [5]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment
>>> a
([0, 1, 2, 5], None)
Python complains that we cannot do a[0] += [5]
since tuples are immutable, but it has done the assignment. What is going on and why has Python performed the command while simultaneously complaining that it cannot perform the command?