Python function parameters with keyword-only argument k

Any #Python function parameters after *args are keyword-only: def myfunc(*args, k): return f'{args=}, {k=}' Want to give k a value? Use a keyword argument: myfunc(10, 20, 30, k=100) Don't need *args? Just use *, and k is keyword only: def myfunc(*, k): return f'{k=}'

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories