New submission from Ali Ramezani <ramezan...@gmail.com>:

In CLI (Command Line Interpreter):
A tuple has a list component then try to += that component. Since tuple doesn't 
allow assignment then it raises error but actually does that.
If you try actual equivalence (A=A+B) it does not.


Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> v=([1],[2])
>>> v[0]=v[0]+[3,4]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment
>>> v
([1], [2])
>>> v[0]+=[3,4]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'tuple' object does not support item assignment
>>> v
([1, 3, 4], [2])
>>>

----------
messages: 410861
nosy: ramezaniua
priority: normal
severity: normal
status: open
title: CLI: Addition assignment for tuples
type: behavior
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46423>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to