Manual
Sums start and the items of an iterable from left to right and returns the total. start defaults to 0. The iterable‘s items are normally numbers, and the start value is not allowed to be a string.
For some use cases, there are good alternatives to sum(). The preferred, fast way to concatenate a sequence of strings is by calling ”.join(sequence). To add floating point values with extended precision, see math.fsum(). To concatenate a series of iterables, consider using itertools.chain().
直译
计算start和iterable从左到右的项合计。
start默认为0,其值不允许字符串;iterable的项通常是数字。
对于一些其他使用情形,这有一些更好的替代sum()的选择。首选,可以通过调用”.join(sequence)快速链接字符串序列;用扩展精度运算math.fsum()求浮点值的和;链接一系列迭代,建议使用