mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Merge from 3.2: improve argument/parameter documentation (issue #15990).
This commit is contained in:
commit
d97c71feda
3 changed files with 99 additions and 18 deletions
|
@ -313,6 +313,27 @@ calling another function by using ``*`` and ``**``::
|
|||
g(x, *args, **kwargs)
|
||||
|
||||
|
||||
.. _faq-argument-vs-parameter:
|
||||
|
||||
What is the difference between arguments and parameters?
|
||||
--------------------------------------------------------
|
||||
|
||||
:term:`Parameters <parameter>` are defined by the names that appear in a
|
||||
function definition, whereas :term:`arguments <argument>` are the values
|
||||
actually passed to a function when calling it. Parameters define what types of
|
||||
arguments a function can accept. For example, given the function definition::
|
||||
|
||||
def func(foo, bar=None, **kwargs):
|
||||
pass
|
||||
|
||||
*foo*, *bar* and *kwargs* are parameters of ``func``. However, when calling
|
||||
``func``, for example::
|
||||
|
||||
func(42, bar=314, extra=somevar)
|
||||
|
||||
the values ``42``, ``314``, and ``somevar`` are arguments.
|
||||
|
||||
|
||||
How do I write a function with output parameters (call by reference)?
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue