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

Ronald Oussoren report at bugs.python.org
Mon May 20 12:41:01 CEST 2013


Ronald Oussoren added the comment:

David: your update to the FAQ looks ok to me.


I don't like updating the __setitem__ of tuple to allow setting an identical value (that is 'a[0] = a[0]'), it is a bit too magic to my taste and hides the real problem.

I'd slightly prefer my idea: update the code generated for += to try performing the assignment before calling __iadd__.  I hadn't looked at the AST compiler before, but at first glance implementing my idea seems easier than I had expected and I'm working on an experimental patch.

----------

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


More information about the Python-bugs-list mailing list