[issue47155] Strange behavior on the tuple that includes list

2022-03-29 Thread Eric V. Smith


Eric V. Smith  added the comment:

There's also this StackOverflow question about it: 
https://stackoverflow.com/questions/38344244/tuples-operator-throws-exception-but-succeeds

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue47155] Strange behavior on the tuple that includes list

2022-03-29 Thread Eric V. Smith


Eric V. Smith  added the comment:

This is an FAQ: 
https://docs.python.org/3/faq/programming.html#why-does-a-tuple-i-item-raise-an-exception-when-the-addition-works

--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue47155] Strange behavior on the tuple that includes list

2022-03-29 Thread Furkan Onder


New submission from Furkan Onder :

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 "", line 1, in 
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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com