[New-bugs-announce] [issue47155] Strange behavior on the tuple that includes list

Furkan Onder report at bugs.python.org
Tue Mar 29 16:26:04 EDT 2022


New submission from Furkan Onder <furkanonder at protonmail.com>:

I am creating the tuple that includes a list and than I am trying to add new value to this list. Interpreter throw the error, but list is changing. I think it doesn't make sense. I think if we throw the type error, list shouldn't be change.

>>> tup = ('hi', 'test', ['a','b'])
>>> tup[2] += 'c'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment
>>> tup
('hi', 'test', ['a', 'b', 'c'])
>>>

----------
components: Interpreter Core
messages: 416291
nosy: furkanonder
priority: normal
severity: normal
status: open
title: Strange behavior on the tuple that includes list
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47155>
_______________________________________


More information about the New-bugs-announce mailing list