Python·100 questions

What is the difference between * and / in function signatures (keyword-only and positional-only)?

Answer
f(a, /, b) — a is positional-only.
f(*, x, y) — x and y are keyword-only.
Reduces errors in calls.
Helps maintain API.
Often used in library code.
Was this answer helpful?

More questions in this topic

Related questions from other topics