Python · Functions

Keyword-only arguments

Arguments after a bare star must be passed by keyword, which keeps call sites readable.

Syntax
def f(*, limit=10):

Example

Open in the lab

More in this group

*args / **kwargs def Default argument Docstring Function as value lambda map() / filter() return

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course