What are keyword-only and positional-only parameters?

Python control flow and functions · Experienced

Model answer

Parameters after a bare * must be passed by name: def f(a, *, b). Parameters before / must be positional: def f(a, /, b). They make APIs clearer and let you change parameter names later without breaking callers.

Learn this topic

Functions in Python: def, Arguments and return in the course Python for Beginners: Learn to Code with Real Projects.

Sign in to add your own answer.

More questions