sum(iterable[, start])
sum Function is mainly used to calculate the sum of an iteratable sequence . In special circumstances ,sum Function can also be used to connect two lists .
1、 Calculate the sum of the sequence
>>> idx_list = [1, 2, 3, 4]
>>> sum(idx_list)
10
>>> sum(idx_list, start=2)
12
2、 Connect two sequences
>>> idx_list = [[1, 2, 3], [4, 5, 6]]
>>> sum(idx_list, [])
[1, 2, 3, 4, 5, 6]