diff --git a/Doc/glossary.rst b/Doc/glossary.rst --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -40,16 +40,14 @@ ABCs with the :mod:`abc` module. argument - A value passed to a function or method, assigned to a named local - variable in the function body. A function or method may have both - positional arguments and keyword arguments in its definition. - Positional and keyword arguments may be variable-length: ``*`` accepts - or passes (if in the function definition or call) several positional - arguments in a list, while ``**`` does the same for keyword arguments - in a dictionary. - - Any expression may be used within the argument list, and the evaluated - value is passed to the local variable. + A value passed to a :term:`function` (or method) and assigned to a named + local variable in the function body. An argument value can be passed + either as a :term:`positional ` or :term:`keyword + argument`. Syntactically, any expression can be used within an argument + list; the evaluated value is passed to the local variable. See the + :ref:`calls` section and :ref:`inspect-signature-object` for the + rules governing assignment to local variables. Also see the + :term:`parameter` glossary entry and :pep:`362`. attribute A value associated with an object which is referenced by name using @@ -402,10 +400,10 @@ ` for examples of how to create and use key functions. keyword argument - Arguments which are preceded with a ``variable_name=`` in the call. - The variable name designates the local name in the function to which the - value is assigned. ``**`` is used to accept or pass a dictionary of - keyword arguments. See :term:`argument`. + An :term:`argument` preceded by ``variable_name=`` in the call syntax or + passed as a value in a dictionary preceded by ``**``. If passed as a + dictionary value, the dictionary key is used as the variable name. + See also :term:`argument`. lambda An anonymous inline function consisting of a single :term:`expression` @@ -548,6 +546,23 @@ subpackages. Technically, a package is a Python module with an ``__path__`` attribute. + parameter + A named entity in a :term:`function` (or method) signature that + corresponds to a value or collection of values that the function can + accept. A parameter can be one of five types: positional-or-keyword (aka + standard), keyword-only, positional-only, var-positional, and + var-keyword. For example, the following function signature has three + parameters:: + + def func(object, *, name=None, **kwargs): + + ``object`` is a standard parameter, ``name`` is keyword-only, and + ``**kwargs`` is var-keyword. Python has no explicit syntax for + defining positional-only parameters, even though many built-in functions + have them, for example. See also the :term:`argument` glossary entry, + the :class:`inspect.Parameter` class, the :ref:`function` section, and + :pep:`362`. + path entry A single location on the :term:`import path` which the :term:`path based finder` consults to find modules for importing. @@ -571,10 +586,10 @@ that contribute to a namespace package, as defined in :pep:`420`. positional argument - The arguments assigned to local names inside a function or method, - determined by the order in which they were given in the call. ``*`` is - used to either accept multiple positional arguments (when in the - definition), or pass several arguments as a list to a function. See + An :term:`argument` that is not a :term:`keyword argument`. Positional + arguments are assigned to local names inside a function according to the + order in which they are given in the call. An :term:`iterable` preceded + by ``*`` is used to pass a sequence of positional arguments. See also :term:`argument`. provisional package