Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:

https://docs.python.org/3/faq/programming.html#faq-augmented-assignment-tuple-error

> for lists, __iadd__ is equivalent to calling extend on the list and returning 
> the list. That’s why we say that for lists, += is a “shorthand” for 
> list.extend

This example is calling extend on list of strings with another string as 
argument. Hence the target string is iterated and each character is added as an 
element. __add__ is different compared __iadd__. For += __iadd__ is called if 
defined and falls back to __add__

----------
nosy: +xtreak

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

Reply via email to