'(Python)Why the sum of list of list and [] is a list?

Why the result of code below is [1, 2, 3, 4, 5]?

In[10]:=sum([[1,2,3], [4,5]],[])
Out[10]:=[1,2,3,4,5]  # why the result is [1, 2, 3, 4, 5]?

The purpose is to get item of all the list in the list [[1,2,3], [4,5]]. (I don't know why "[]" in the second argument of sum.)

sum


Solution 1:[1]

Since

sum([1, 2, 3], 0)

means 0 + 1 + 2 + 3 ,

then

sum([[1, 2, 3], [4, 5]], [])

means: [] + [1, 2, 3] + [4, 5]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 yueyinqiu