Looking for documentation on how Python assigns to function parameters

Jussi Piitulainen jussi.piitulainen at helsinki.fi
Wed Mar 1 06:27:29 EST 2017


Steve D'Aprano writes:

> 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.

Possibly https://docs.python.org/3/reference/expressions.html#calls

Python 3.6.0 documentation, Language Reference
6. Expressions
6.3 Primaries
6.3.4 Calls



More information about the Python-list mailing list