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