[New-bugs-announce] [issue31141] Start should be a keyword argument of the built-in sum

Mark Bell report at bugs.python.org
Tue Aug 8 07:52:48 EDT 2017


New submission from Mark Bell:

The built-in function sum takes an optional argument "start" to specify what value to start adding from (defaults to 0). This argument should be a keyword argument in order to match the other built-in functions such as:

    enumerate(range(10), start=5)

This patch allows users to write:

    sum(range(10), start=5)

which previously raised "TypeError: sum() takes no keyword arguments". Since the only change is making an optional positional argument into a keyword argument, this has no effect on any existing code using the current convention of:

    sum(range(10), 5)

----------
components: ctypes
messages: 299908
nosy: Mark.Bell
priority: normal
severity: normal
status: open
title: Start should be a keyword argument of the built-in sum
versions: Python 2.7, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31141>
_______________________________________


More information about the New-bugs-announce mailing list