[issue39964] adding a string to a list works differently with x+='' compared to x=x+''

Steven D'Aprano report at bugs.python.org
Sat Mar 14 23:25:46 EDT 2020


Steven D'Aprano <steve+python at pearwood.info> added the comment:

That's not a bug. The in-place addition `+=` for lists is equivalent to the extend method. See the documentation:

https://docs.python.org/3/library/stdtypes.html#mutable-sequence-types

and the tutorial:

https://docs.python.org/3/tutorial/datastructures.html

----------
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39964>
_______________________________________


More information about the Python-bugs-list mailing list