This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Item assignment in tuple mutates list despite throwing error
Type: behavior Stage: resolved
Components: Versions: Python 3.4, Python 3.5, Python 2.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: njayinthehouse, xtreak
Priority: normal Keywords:

Created on 2018-06-16 15:13 by njayinthehouse, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg319748 - (view) Author: (njayinthehouse) Date: 2018-06-16 15:13
Seems like a bug.

    >>> a = (1, [1])
    >>> a[1] += [2]
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: 'tuple' object does not support item assignment
    >>> a
    (1, [1, 2])
msg319762 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-06-16 17:00
Interesting. I googled this and came across this note which covers this :
Date User Action Args
2022-04-11 14:59:01adminsetgithub: 78060
2018-06-16 21:04:11r.david.murraysetstatus: open -> closed
resolution: not a bug
stage: resolved
2018-06-16 17:00:05xtreaksetnosy: + xtreak
messages: + msg319762
2018-06-16 15:13:15njayinthehousecreate