Python's parameter kinds and how arguments bind to them
A Python signature has five kinds of parameters and a fixed order. Positional-or-keyword parameters can be supplied either way. Default parameters give a fallback value if the caller omits them. *args collects extra positional arguments into a tuple. Keyword-only parameters, which come after * or *args, must be named by the caller. **kwargs collects extra keyword arguments into a dict. Since 3.8 you can also mark positional-only parameters with a / in the signature. The full order is: positional-only, /, positional-or-keyword, *args (or bare *), keyword-only, **kwargs.
How binding works: at call time Python fills positional-only and positional parameters left to right from positional arguments, then matches keyword arguments by name, then applies defaults, and finally raises TypeError for anything missing, duplicated ('multiple values for argument') or unexpected. On the calling side, * and ** unpack iterables and mappings into arguments. Since 3.6 **kwargs preserves the order in which the caller passed the keywords.
Design guidance I give in practice: make rarely used or boolean options keyword-only (def send(to, body, *, retries=3, dry_run=False)) so call sites read clearly and you can add parameters without breaking callers; use positional-only for parameters whose names are not part of the API, which lets you rename them later; and prefer explicit parameters over **kwargs, because **kwargs silently swallows typos like timout=5 unless you validate it. *args and **kwargs are right for decorators, wrappers and forwarding, where you do not know the callee's signature - and use functools.wraps so the wrapper keeps the original's name and docs.
Common mistakes: placing a default before a non-default positional parameter (SyntaxError), reusing a mutable object as a default value (see the mutable default pitfall), and thinking *args is a list (it's a tuple). The positional-only / marker needs Python 3.8+, so mention it if the codebase supports older versions.
0-2 years experience
2-5 years experience
5-8 years experience
8+ years experience