Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6e5b2ac

Browse files
committed
Merge from 3.2: Issue #12531: add index entries to documentation of * and ** in function calls
2 parents ecb3bd9 + 7bd081c commit 6e5b2ac

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

Doc/reference/expressions.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -667,12 +667,15 @@ dictionary containing the excess keyword arguments (using the keywords as keys
667667
and the argument values as corresponding values), or a (new) empty dictionary if
668668
there were no excess keyword arguments.
669669

670+
.. index::
671+
single: *; in function calls
672+
670673
If the syntax ``*expression`` appears in the function call, ``expression`` must
671-
evaluate to a sequence. Elements from this sequence are treated as if they were
672-
additional positional arguments; if there are positional arguments *x1*,...,
673-
*xN*, and ``expression`` evaluates to a sequence *y1*, ..., *yM*, this is
674-
equivalent to a call with M+N positional arguments *x1*, ..., *xN*, *y1*, ...,
675-
*yM*.
674+
evaluate to an iterable. Elements from this iterable are treated as if they
675+
were additional positional arguments; if there are positional arguments
676+
*x1*, ... ,*xN*, and ``expression`` evaluates to a sequence *y1*, ..., *yM*,
677+
this is equivalent to a call with M+N positional arguments *x1*, ..., *xN*,
678+
*y1*, ..., *yM*.
676679

677680
A consequence of this is that although the ``*expression`` syntax may appear
678681
*after* some keyword arguments, it is processed *before* the keyword arguments
@@ -693,6 +696,9 @@ A consequence of this is that although the ``*expression`` syntax may appear
693696
It is unusual for both keyword arguments and the ``*expression`` syntax to be
694697
used in the same call, so in practice this confusion does not arise.
695698

699+
.. index::
700+
single: **; in function calls
701+
696702
If the syntax ``**expression`` appears in the function call, ``expression`` must
697703
evaluate to a mapping, the contents of which are treated as additional keyword
698704
arguments. In the case of a keyword appearing in both ``expression`` and as an

0 commit comments

Comments
 (0)