Я просто наткнулся на то, что было довольно странно.
>>> t = ([],)
>>> t[0].append('hello')
>>> t
(['hello'],)
>>> t[0] += ['world']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment
>>> t
(['hello', 'world'],)
Почему он поднимает TypeError
и все же меняет list
внутри tuple
?