@@ -1054,10 +1054,20 @@ used in the same call, so in practice this confusion does not often arise.
1054
1054
1055
1055
If the syntax ``**expression `` appears in the function call, ``expression `` must
1056
1056
evaluate to a :term: `mapping `, the contents of which are treated as
1057
- additional keyword arguments. If a keyword is already present
1058
- (as an explicit keyword argument, or from another unpacking),
1057
+ additional keyword arguments. If a parameter matching a key has already been
1058
+ given a value (by an explicit keyword argument, or from another unpacking),
1059
1059
a :exc: `TypeError ` exception is raised.
1060
1060
1061
+ When ``**expression `` is used, each key in this mapping must be
1062
+ a string.
1063
+ Each value from the mapping is assigned to the first formal parameter
1064
+ eligible for keyword assignment whose name is equal to the key.
1065
+ A key need not be a Python identifier (e.g. ``"max-temp °F" `` is acceptable,
1066
+ although it will not match any formal parameter that could be declared).
1067
+ If there is no match to a formal parameter
1068
+ the key-value pair is collected by the ``** `` parameter, if there is one,
1069
+ or if there is not, a :exc: `TypeError ` exception is raised.
1070
+
1061
1071
Formal parameters using the syntax ``*identifier `` or ``**identifier `` cannot be
1062
1072
used as positional argument slots or as keyword argument names.
1063
1073
0 commit comments