Skip to content

Commit b430994

Browse files
committed
Add additional links and index entries for "argument" and "parameter".
This adds to the work done for issue python#15990 (i.e. f44b8d69e5fc and the commits referenced there).
1 parent 0b64c14 commit b430994

4 files changed

Lines changed: 28 additions & 13 deletions

File tree

Doc/faq/programming.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ calling another function by using ``*`` and ``**``::
313313
g(x, *args, **kwargs)
314314

315315

316+
.. index::
317+
single: argument; difference from parameter
318+
single: parameter; difference from argument
319+
316320
.. _faq-argument-vs-parameter:
317321

318322
What is the difference between arguments and parameters?

Doc/glossary.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,9 @@ Glossary
240240

241241
function
242242
A series of statements which returns some value to a caller. It can also
243-
be passed zero or more arguments which may be used in the execution of
244-
the body. See also :term:`argument` and :term:`method`.
243+
be passed zero or more :term:`arguments <argument>` which may be used in
244+
the execution of the body. See also :term:`parameter`, :term:`method`,
245+
and the :ref:`function` section.
245246

246247
__future__
247248
A pseudo-module which programmers can use to enable new language features

Doc/reference/compound_stmts.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,9 @@ is equivalent to ::
417417
statement.
418418

419419

420+
.. index::
421+
single: parameter; function definition
422+
420423
.. _function:
421424
.. _def:
422425

@@ -478,11 +481,14 @@ is equivalent to ::
478481
def func(): pass
479482
func = f1(arg)(f2(func))
480483

481-
.. index:: triple: default; parameter; value
484+
.. index::
485+
triple: default; parameter; value
486+
single: argument; function definition
482487

483-
When one or more parameters have the form *parameter* ``=`` *expression*, the
484-
function is said to have "default parameter values." For a parameter with a
485-
default value, the corresponding argument may be omitted from a call, in which
488+
When one or more :term:`parameters <parameter>` have the form *parameter* ``=``
489+
*expression*, the function is said to have "default parameter values." For a
490+
parameter with a default value, the corresponding :term:`argument` may be
491+
omitted from a call, in which
486492
case the parameter's default value is substituted. If a parameter has a default
487493
value, all following parameters up until the "``*``" must also have a default
488494
value --- this is a syntactic restriction that is not expressed by the grammar.

Doc/reference/expressions.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -600,17 +600,18 @@ upper bound and stride, respectively, substituting ``None`` for missing
600600
expressions.
601601

602602

603+
.. index::
604+
object: callable
605+
single: call
606+
single: argument; call semantics
607+
603608
.. _calls:
604609

605610
Calls
606611
-----
607612

608-
.. index:: single: call
609-
610-
.. index:: object: callable
611-
612-
A call calls a callable object (e.g., a function) with a possibly empty series
613-
of arguments:
613+
A call calls a callable object (e.g., a :term:`function`) with a possibly empty
614+
series of :term:`arguments <argument>`:
614615

615616
.. productionlist::
616617
call: `primary` "(" [`argument_list` [","] | `comprehension`] ")"
@@ -628,11 +629,14 @@ of arguments:
628629
A trailing comma may be present after the positional and keyword arguments but
629630
does not affect the semantics.
630631

632+
.. index::
633+
single: parameter; call semantics
634+
631635
The primary must evaluate to a callable object (user-defined functions, built-in
632636
functions, methods of built-in objects, class objects, methods of class
633637
instances, and all objects having a :meth:`__call__` method are callable). All
634638
argument expressions are evaluated before the call is attempted. Please refer
635-
to section :ref:`function` for the syntax of formal parameter lists.
639+
to section :ref:`function` for the syntax of formal :term:`parameter` lists.
636640

637641
.. XXX update with kwonly args PEP
638642

0 commit comments

Comments
 (0)