Looking for documentation on how Python assigns to function parameters

Steve D'Aprano steve+python at pearwood.info
Wed Mar 1 06:18:42 EST 2017


Given a function like this:


def func(alpha, beta, gamma, delta=4, *args, **kw):
    ...


which is called in some fashion:

# say
func(1, 2, gamma=3, epsilon=5)

which may or may not be valid:

func(1, 2, alpha=0)

how does Python match up the formal parameters in the `def` statement with
the arguments given in the call to `func`?

I'm looking for official docs, if possible. So far I've had no luck finding
anything.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.



More information about the Python-list mailing list