[issue40264] List item inside tuple seemingly allows for item assignment even after throwing error

2020-04-12 Thread Eric V. Smith


Eric V. Smith  added the comment:

This isn't a bug. See the 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
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue40264] List item inside tuple seemingly allows for item assignment even after throwing error

2020-04-12 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +rhettinger

___
Python tracker 

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



[issue40264] List item inside tuple seemingly allows for item assignment even after throwing error

2020-04-12 Thread Rahul B


New submission from Rahul B :

Even though item assignment throws error, the list inside tuple 'a' gets 
modified in place. Refer below, where the list value [8] gets added to the list 
value [5,6,7,7] at a[3]

>>> a
(2, 3, 4, [5, 6, 7, 7], 1)
>>> id(a[3])
140531212178376
>>> a[3]+=[8]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'tuple' object does not support item assignment
>>> a
(2, 3, 4, [5, 6, 7, 7, 8], 1)
>>> id(a[3])
140531212178376

--
messages: 366264
nosy: Rahul B
priority: normal
severity: normal
status: open
title: List item inside tuple seemingly allows for item assignment even after 
throwing error
type: behavior
versions: Python 3.7

___
Python tracker 

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