diff options
author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-11-28 10:37:42 (GMT) |
---|---|---|
committer | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-11-28 10:37:42 (GMT) |
commit | d97c71fedacd070e22ec2de3cd2e6f03c3c8b520 (patch) | |
tree | 30e4dd07aff5ed3cbc3d136b1dfff72178f02ba2 /Doc/faq | |
parent | bb4e941c6d721c2461f7dd30a84565abc350eca3 (diff) | |
parent | c2a7fd60e1e1cc86c52d7409b5b8d84ee447a4ae (diff) | |
download | cpython-d97c71fedacd070e22ec2de3cd2e6f03c3c8b520.zip cpython-d97c71fedacd070e22ec2de3cd2e6f03c3c8b520.tar.gz cpython-d97c71fedacd070e22ec2de3cd2e6f03c3c8b520.tar.bz2 |
Merge from 3.2: improve argument/parameter documentation (issue #15990).
Diffstat (limited to 'Doc/faq')
-rw-r--r-- | Doc/faq/programming.rst | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst index d33e25b..2d5d2b1 100644 --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -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)? --------------------------------------------------------------------- |