summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-08-19 20:57:10 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-08-19 20:57:10 (GMT)
commit2d735bc09876e8216bf6708bb598923e07a2ac4b (patch)
treeb242296c96c8988ba3c783474c960432d13bef67 /Doc
parentde0de885f77d40ddb7e9f2afc8be5a99b9cf01ec (diff)
downloadcpython-2d735bc09876e8216bf6708bb598923e07a2ac4b.zip
cpython-2d735bc09876e8216bf6708bb598923e07a2ac4b.tar.gz
cpython-2d735bc09876e8216bf6708bb598923e07a2ac4b.tar.bz2
allow keyword args after *args in a function call
Diffstat (limited to 'Doc')
-rw-r--r--Doc/reference/expressions.rst19
1 files changed, 10 insertions, 9 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index 1e94d40..945df61 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -612,11 +612,11 @@ of arguments:
call: `primary` "(" [`argument_list` [","]
: | `expression` `genexpr_for`] ")"
argument_list: `positional_arguments` ["," `keyword_arguments`]
- : ["," "*" `expression`]
- : ["," "**" `expression`]
+ : ["," "*" `expression`] ["," `keyword_arguments`]
+ : ["," "**" `expression`]
: | `keyword_arguments` ["," "*" `expression`]
- : ["," "**" `expression`]
- : | "*" `expression` ["," "**" `expression`]
+ : ["," `keyword_arguments`] ["," "**" `expression`]
+ : | "*" `expression` ["," `keyword_arguments`] ["," "**" `expression`]
: | "**" `expression`
positional_arguments: `expression` ("," `expression`)*
keyword_arguments: `keyword_item` ("," `keyword_item`)*
@@ -674,12 +674,13 @@ there were no excess keyword arguments.
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*.
+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 appears
-*after* any keyword arguments, it is processed *before* the keyword arguments
+A consequence of this is that although the ``*expression`` syntax may appear
+*after* some keyword arguments, it is processed *before* the keyword arguments
(and the ``**expression`` argument, if any -- see below). So::
>>> def f(a, b):