[issue45293] List inplace addition different from normal addition
Raymond Hettinger
report at bugs.python.org
Sun Sep 26 16:58:22 EDT 2021
Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:
Kapil, this behavior was intentional (not a bug), but later regarded as a design mistake. GvR has said that if he had to do it over again list.__iadd__ would only accept other lists. The problem arises when people write "somelist += 'hello'" and expect it to add a single string with one word rather than five one letter strings. That said, the current behavior is guaranteed, people rely on it, and we cannot change it.
As Karthikeyan points out, this is documented. However since the docs have grown so voluminous, it is often difficult to find any one particular fact.
----------
nosy: +rhettinger
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45293>
_______________________________________
More information about the Python-bugs-list
mailing list