Language Syntax

Positional only parameters — Python syntax

Names before / can receive arguments only by position. This can preserve public calling contracts while allowing parameter renaming. A positional-only name may separately appear as a key in **kwargs if that parameter exists. Added for Python-defined functions in 3.8.

Formal Syntax & Structure

python syntaxpython
def f(a, b, /, c=0):    suite

Working Example

Example Snippetpython
def f(name,/,**kwargs):    return name,kwargsprint(f('first',name='second'))
Python Reference