From 6080e2f3a7442e0b2dfdcc996eb06ab5676e9ca4 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Wed, 5 Jun 2019 23:53:50 +0100 Subject: [PATCH 1/2] Use PEP570 syntax for sum() --- Doc/library/functions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 415a65b4946f08c..e8a21c496171bf8 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1562,7 +1562,7 @@ are always available. They are listed here in alphabetical order. about strings, see :ref:`textseq`. -.. function:: sum(iterable[, start]) +.. function:: sum(iterable, /[, start]) 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, From e035eee4379178bd802233ca3b3cc4d11201095f Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Thu, 6 Jun 2019 00:03:58 +0100 Subject: [PATCH 2/2] fixup! Use PEP570 syntax for sum() --- Doc/library/functions.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index e8a21c496171bf8..88977056723f2e6 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1562,11 +1562,11 @@ are always available. They are listed here in alphabetical order. about strings, see :ref:`textseq`. -.. function:: sum(iterable, /[, start]) +.. function:: sum(iterable, /, start=0) 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. + total. 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 :func:`sum`. The preferred, fast way to concatenate a sequence of strings is by calling