sum() requires number, not simply __add__

Chris Angelico rosuav at
Thu Feb 23 23:04:23 CET 2012

On Fri, Feb 24, 2012 at 8:59 AM, Arnaud Delobelle <arnodel at> wrote:
> def sum(iterable, start=_sentinel, _sentinel=_sentinel):

Is this a reason for Python to introduce a new syntax, such as:

def foo(blah, optional=del):
    if optional is del: print("No argument was provided")

Basically, 'del' is treated like a unique non-providable object, only
possible in an argument list and only if the argument was omitted. No
more proliferation of individual sentinels... what do you think?

(I picked "del" because it's an existing keyword. Fairly arbitrary
choice though.)

Chris Angelico

More information about the Python-list mailing list