[New-bugs-announce] [issue24677] "def f(*args, ): pass" does not compile

Adam Bartoš report at bugs.python.org
Tue Jul 21 12:43:42 CEST 2015


New submission from Adam Bartoš:

I think that a trailing comma in function definition should be allowed also after *. 

Current situation with definitions:
def f(*args, ): pass # SyntaxError
def f(*, ): pass # SyntaxError
def f(*, a, ): pass # SyntaxError
def f(*, a=2, ): pass # SyntaxError

def f(a, ): pass # Ok
def f(, ): pass # SyntaxError – this should probably stay error

Corresponding calls:
f(*args, ) # Ok
f(*args, a, ) # Ok
f(*args, a=2, ) # Ok 

f(a, ) # Ok
f(, ) # SyntaxError – this is why the corresponding def behavior should stay

My use case:
def f(*, 
        long = 1, 
        list = 2, 
        of = 3, 
        kwonly = 4, 
        parameters = 5, 
    ):
    ...

----------
messages: 247023
nosy: Drekin
priority: normal
severity: normal
status: open
title: "def f(*args, ): pass" does not compile

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


More information about the New-bugs-announce mailing list