Open skirpichev opened 2 months ago
https://github.com/python/cpython/blob/2f5c3b09e45798a18d60841d04a165fb062be666/Doc/reference/compound_stmts.rst?plain=1#L1211-L1224
In parameter_list_starargs - everything can be optional, except for *, and that permits incorrect function definitions like def foo(*):
parameter_list_starargs
*
def foo(*)
>>> def foo(*): pass File "<stdin>", line 1 def foo(*): pass ^ SyntaxError: named arguments must follow bare *
See d.p.o thread https://discuss.python.org/t/56998. I'll provide a patch, based on suggested solution.
CC @norpadon
def foo(*args): pass
@mashkoor098, not sure I get your point.
is a correct syntax, yes. Another example:
def bar(*, spam='spam!'): pass
https://github.com/python/cpython/blob/2f5c3b09e45798a18d60841d04a165fb062be666/Doc/reference/compound_stmts.rst?plain=1#L1211-L1224
In
parameter_list_starargs
- everything can be optional, except for*
, and that permits incorrect function definitions likedef foo(*)
:See d.p.o thread https://discuss.python.org/t/56998. I'll provide a patch, based on suggested solution.
CC @norpadon
Linked PRs