Minor doc improvement (GH-10341)
Change "star-operator" to "* operator".
(cherry picked from commit dfd775a0b1
)
Co-authored-by: Andre Delfino <adelfino@gmail.com>
This commit is contained in:
parent
23eb816399
commit
e16599c48c
|
@ -959,7 +959,7 @@ function:
|
||||||
>>> getattr(p, 'x')
|
>>> getattr(p, 'x')
|
||||||
11
|
11
|
||||||
|
|
||||||
To convert a dictionary to a named tuple, use the double-star-operator
|
To convert a dictionary to a named tuple, use the ``**`` operator
|
||||||
(as described in :ref:`tut-unpacking-arguments`):
|
(as described in :ref:`tut-unpacking-arguments`):
|
||||||
|
|
||||||
>>> d = {'x': 11, 'y': 22}
|
>>> d = {'x': 11, 'y': 22}
|
||||||
|
|
|
@ -560,7 +560,7 @@ The reverse situation occurs when the arguments are already in a list or tuple
|
||||||
but need to be unpacked for a function call requiring separate positional
|
but need to be unpacked for a function call requiring separate positional
|
||||||
arguments. For instance, the built-in :func:`range` function expects separate
|
arguments. For instance, the built-in :func:`range` function expects separate
|
||||||
*start* and *stop* arguments. If they are not available separately, write the
|
*start* and *stop* arguments. If they are not available separately, write the
|
||||||
function call with the ``*``\ -operator to unpack the arguments out of a list
|
function call with the ``*`` operator to unpack the arguments out of a list
|
||||||
or tuple::
|
or tuple::
|
||||||
|
|
||||||
>>> list(range(3, 6)) # normal call with separate arguments
|
>>> list(range(3, 6)) # normal call with separate arguments
|
||||||
|
@ -573,7 +573,7 @@ or tuple::
|
||||||
single: **; in function calls
|
single: **; in function calls
|
||||||
|
|
||||||
In the same fashion, dictionaries can deliver keyword arguments with the
|
In the same fashion, dictionaries can deliver keyword arguments with the
|
||||||
``**``\ -operator::
|
``**`` operator::
|
||||||
|
|
||||||
>>> def parrot(voltage, state='a stiff', action='voom'):
|
>>> def parrot(voltage, state='a stiff', action='voom'):
|
||||||
... print("-- This parrot wouldn't", action, end=' ')
|
... print("-- This parrot wouldn't", action, end=' ')
|
||||||
|
|
Loading…
Reference in New Issue