Yes.
list.extend() simply extends the arguments given at the end of the list.
According to docs :
Expand the list by adding all the elements to this list; equivalent to [len (a):] = L.
So:
>>> a = [1, 2, 3] >>> a[len(a):] = [4, 5] >>> a [1, 2, 3, 4, 5]
By the way, do not obscure the built-in type by naming the list list .
source share