defined; thus, a mutable object such as a list or dictionary used as default value will be shared by all calls that don’t specify an argument value for the corresponding slot; this should usually be avoided.) If there are any unfilled slots for which no default value is specified, a$_{TypeError}$ exception is raised. Otherwise, the list of filled slots is used as the argument list for the call. 

CPython implementation detail: An implementation may provide built-in functions whose positional parameters do not have names, even if they are ‘named’ for the purpose of documentation, and which therefore cannot be supplied by keyword. In CPython, this is the case for functions implemented in C that use$_{PyArg_ParseTuple()}$ to parse their arguments. 

If there are more positional arguments than there are formal parameter slots, a TypeError exception is raised, unless a formal parameter using the syntax *identifier is present; in this case, that formal parameter receives a tuple containing the excess positional arguments (or an empty tuple if there were no excess positional arguments). 

If any keyword argument does not correspond to a formal parameter name, a TypeError exception is raised, unless a formal parameter using the syntax **identifier is present; in this case, that formal parameter receives a dictio- nary containing the excess keyword arguments (using the keywords as keys and the argument values as corresponding values), or a (new) empty dictionary if there were no excess keyword arguments. 

If the syntax$_{*expression}$appears in the function call,$_{expression}$ must evaluate to an iterable . Elements from these iterables are treated as if they were additional positional arguments. For the call$_{f(x1, x2, *y,}$ x3, x4) , if y evaluates to a sequence y1 , …, yM , this is equivalent to a call with M+4 positional arguments x1 , x2 , y1 , …, yM , x3 , x4 . 

A consequence of this is that although the$_{*expression}$syntax may appear after explicit keyword arguments, it is processed before the keyword arguments (and any$_{**expression}$ arguments – see below). So: 

>>>def f(a, b): ... print(a, b) ... >>> f(b=1,*(2,)) 2 1 >>> f(a=1,*(2,)) Traceback (most recent call last): File "<stdin>" , line1, in <module> TypeError: f() got multiple values for keyword argument 'a' >>> f(1,*(2,)) 1 2 

It is unusual for both keyword arguments and the$_{*expression}$syntax to be used in the same call, so in practice this confusion does not arise. 

If the syntax$_{**expression}$ appears in the function call,$_{expression}$ must evaluate to a mapping , the con- tents of which are treated as additional keyword arguments. If a keyword is already present (as an explicit keyword argument, or from another unpacking), a$_{TypeError}$ exception is raised. 

Formal parameters using the syntax$_{*identifier}$ or$_{**identifier}$cannot be used as positional argument slots or as keyword argument names. 

Changed in version 3.5: Function calls accept any number of$_{*}$and$_{**}$ unpackings, positional arguments may follow iterable unpackings ($_{*}$ ), and keyword arguments may follow dictionary unpackings ($_{**}$ ). Originally proposed by PEP 448 . 

A call always returns some value, possibly$_{None}$ , unless it raises an exception. How this value is computed depends on the type of the callable object. 

If it is— 

a user-defined function: The code block for the function is executed, passing it the argument list. The first thing the code block will do is bind the formal parameters to the arguments; this is described in section Function definitions . When the code block executes a$_{return}$statement, this specifies the return value of the function call. 

a built-in function or method: The result is up to the interpreter; see built-in-funcs for the descriptions of built-in functions and methods. 

