changeset: 71549:8328fe952303 branch: 2.7 parent: 71546:56e7b42089c8 user: Eli Bendersky date: Fri Jul 29 14:45:08 2011 +0300 files: Doc/reference/expressions.rst description: Issue #12531: add index entries to documentation of * and ** in function calls diff -r 56e7b42089c8 -r 8328fe952303 Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst Thu Jul 28 23:56:38 2011 -0700 +++ b/Doc/reference/expressions.rst Fri Jul 29 14:45:08 2011 +0300 @@ -735,12 +735,15 @@ 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 @@ -761,6 +764,9 @@ 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

AltStyle によって変換されたページ (->オリジナル) /