| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -124,13 +124,13 @@ inside the function) that was added "just in case" and is seemingly never used, | |||
| 124 | 124 | than to add a new optional argument and its logic when needed. | |
| 125 | 125 | ||
| 126 | 126 | 3. The **arbitrary argument list** is the third way to pass arguments to a | |
| 127 | - function. If the function intention is better expressed by a signature with an | ||
| 128 | - extensible number of positional arguments, it can be defined with the ``*args`` | ||
| 129 | - constructs. In the function body, ``args`` will be a tuple of all the | ||
| 130 | - remaining positional arguments. For example, ``send(message, *args)`` can be | ||
| 131 | - called with each recipient as an argument: ``send('Hello', 'God', 'Mom', | ||
| 132 | - 'Cthulhu')``, and in the function body ``args`` will be equal to ``('God', | ||
| 133 | - 'Mom', 'Cthulhu')``. | ||
| 127 | + function. If the function intention is better expressed by a signature with | ||
| 128 | + an extensible number of positional arguments, it can be defined with the | ||
| 129 | + ``*args`` constructs. In the function body, ``args`` will be a tuple of all | ||
| 130 | + the remaining positional arguments. For example, ``send(message, *args)`` | ||
| 131 | + can be called with each recipient as an argument:``send('Hello', 'God', | ||
| 132 | + 'Mom', 'Cthulhu')``, and in the function body ``args`` will be equal to | ||
| 133 | + ``('God', 'Mom', 'Cthulhu')``. | ||
| 134 | 134 | ||
| 135 | 135 | However, this construct has some drawbacks and should be used with caution. If a | |
| 136 | 136 | function receives a list of arguments of the same nature, it is often more | |
| Back | FazBrowse Home | New Git URL |
0 commit comments