[New-bugs-announce] [issue45293] List inplace addition different from normal addition
Kapil Bansal
report at bugs.python.org
Sun Sep 26 08:13:59 EDT 2021
New submission from Kapil Bansal <kapilbansal.gbpecdelhi at gmail.com>:
Hi,
I tried addition and in-place addition on a list.
>>> l = ['a', 'b', 'c']
>>> l = l + 'de' (raises an error)
>>> l += 'de'
>>> print(l)
['a', 'b' , 'c', 'd', 'e']
I want to ask why the behaviour of both these are different?? If it is done intentionally, then it should be there in the documentation but I am not able to find any reference.
----------
messages: 402658
nosy: KapilBansal320
priority: normal
severity: normal
status: open
title: List inplace addition different from normal addition
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45293>
_______________________________________
More information about the New-bugs-announce
mailing list