An hybrid list-tuple concatenation is not allowed
>>> []+(1, 2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can only concatenate list (not "tuple") to list
>>>
hence I was expecting (*) that the following code raises a TypeError :
>>> x = []
>>>
>>> x += (1, 2)
>>>
>>> x
>>>
[1, 2]
>>>
Any explanation ?
(*) as the docs states, the augmented assignment is supposed to perform the
concatenation :
An augmented assignment (...) performs the binary operation specific to the
type of assignment on the two operands (...)
--
https://mail.python.org/mailman/listinfo/python-list