[issue17973] '+=' on a list inside tuple both succeeds and raises an exception

Ronald Oussoren report at bugs.python.org
Tue May 14 10:52:10 CEST 2013


Ronald Oussoren added the comment:

This is a side effect to the way the in place operators work.

Basically "a[0] += [3]" is evaluated as:

    a[0] = a[0].__iadd__([3])

The call to __iadd__ succeeds, which is why the list is updated, but you get an exception when the interpreter tries to update item 0 of the tuple.

----------
nosy: +ronaldoussoren

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17973>
_______________________________________


More information about the Python-bugs-list mailing list