5 ms·
Python calls them keyword arguments.
by rileymat2 4mo ago
Python calls them keyword arguments.
- antonvs 4mo agoPython’s perversity is fractal.
- cenamus 4mo agoAnd I suppose Lisp started that with :key args
- tonyarkles 4mo agoThey do, but they're also not strictly required to be named explicitly: They can be: >>> def foo(bar=None): ... print(bar) ... >>> foo() None >>> foo(bar="baz") baz >>> foo(bar="baz", baz="azp") Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: foo() got an unexpected keyword argument 'baz' But you can also use them generically: >>> def bar(**kwargs): ... print(kwargs) ... >>> bar() {} >>> bar(site="HN", user="tonyarkles") {'site': 'HN', 'user': 'tonyarkles'}