I have the following code that breaks:
l = []
tup = ('a', 'b')
l = l + tup
which gives the below error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can only concatenate list (not "tuple") to list
but the below code runs
l = []
tup = ('a','b')
l += tup
without any error.
I always thought l+= is the same as l = l +
What is going on over here?