mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 23:00:18 +00:00
Indent unindented content in numbered list
This commit is contained in:
@@ -124,13 +124,13 @@ inside the function) that was added "just in case" and is seemingly never used,
|
|||||||
than to add a new optional argument and its logic when needed.
|
than to add a new optional argument and its logic when needed.
|
||||||
|
|
||||||
3. The **arbitrary argument list** is the third way to pass arguments to a
|
3. The **arbitrary argument list** is the third way to pass arguments to a
|
||||||
function. If the function intention is better expressed by a signature with an
|
function. If the function intention is better expressed by a signature with
|
||||||
extensible number of positional arguments, it can be defined with the ``*args``
|
an extensible number of positional arguments, it can be defined with the
|
||||||
constructs. In the function body, ``args`` will be a tuple of all the
|
``*args`` constructs. In the function body, ``args`` will be a tuple of all
|
||||||
remaining positional arguments. For example, ``send(message, *args)`` can be
|
the remaining positional arguments. For example, ``send(message, *args)``
|
||||||
called with each recipient as an argument: ``send('Hello', 'God', 'Mom',
|
can be called with each recipient as an argument:``send('Hello', 'God',
|
||||||
'Cthulhu')``, and in the function body ``args`` will be equal to ``('God',
|
'Mom', 'Cthulhu')``, and in the function body ``args`` will be equal to
|
||||||
'Mom', 'Cthulhu')``.
|
``('God', 'Mom', 'Cthulhu')``.
|
||||||
|
|
||||||
However, this construct has some drawbacks and should be used with caution. If a
|
However, this construct has some drawbacks and should be used with caution. If a
|
||||||
function receives a list of arguments of the same nature, it is often more
|
function receives a list of arguments of the same nature, it is often more
|
||||||
|
|||||||
Reference in New Issue
Block a user