summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2011-07-30 04:07:29 (GMT)
committerEli Bendersky <eliben@gmail.com>2011-07-30 04:07:29 (GMT)
commit6e5b2ac400ed6b9eef0c36977f70a0860e2fa001 (patch)
tree97d232f890ecc13ffc3702e10fef5c5618ada9d5 /Doc/reference
parentecb3bd93ff9508a4ec0b705b3778b04a0590e5e7 (diff)
parent7bd081c1179e0dd7f7f325ff07a2b50f1f760db0 (diff)
downloadcpython-6e5b2ac400ed6b9eef0c36977f70a0860e2fa001.zip
cpython-6e5b2ac400ed6b9eef0c36977f70a0860e2fa001.tar.gz
cpython-6e5b2ac400ed6b9eef0c36977f70a0860e2fa001.tar.bz2
Merge from 3.2: Issue #12531: add index entries to documentation of * and ** in function calls
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/expressions.rst16
1 files changed, 11 insertions, 5 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index f882952..d85a9c6 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -667,12 +667,15 @@ dictionary 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.
+.. index::
+ single: *; in function calls
+
If the syntax ``*expression`` appears in the function call, ``expression`` must
-evaluate to a sequence. Elements from this sequence are treated as if they were
-additional positional arguments; if there are positional arguments *x1*,...,
-*xN*, and ``expression`` evaluates to a sequence *y1*, ..., *yM*, this is
-equivalent to a call with M+N positional arguments *x1*, ..., *xN*, *y1*, ...,
-*yM*.
+evaluate to an iterable. Elements from this iterable are treated as if they
+were additional positional arguments; if there are positional arguments
+*x1*, ... ,*xN*, and ``expression`` evaluates to a sequence *y1*, ..., *yM*,
+this is equivalent to a call with M+N positional arguments *x1*, ..., *xN*,
+*y1*, ..., *yM*.
A consequence of this is that although the ``*expression`` syntax may appear
*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
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.
+.. index::
+ single: **; in function calls
+
If the syntax ``**expression`` appears in the function call, ``expression`` must
evaluate to a mapping, the contents of which are treated as additional keyword
arguments. In the case of a keyword appearing in both ``expression`` and as an