diff --git a/Doc/glossary.rst b/Doc/glossary.rst --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -40,16 +40,23 @@ 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. + 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 + as either a positional or keyword argument. Syntactically, any + expression can be used within an argument list; the evaluated value is + passed to the local variable. - Any expression may be used within the argument list, and the evaluated - value is passed to the local variable. + A :term:`keyword argument` is any argument preceded by ``variable_name=`` + in the calling 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. An argument that is not a keyword argument is a + :term:`positional 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 the :ref:`calls` section 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 +409,7 @@ ` 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`. + See :term:`argument`. lambda An anonymous inline function consisting of a single :term:`expression` @@ -548,6 +552,28 @@ 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 an :term:`argument` or collection of arguments 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. In the following example, ``*iterables`` is + var-positional:: + + def zip(*iterables): + + Python has no explicit syntax for defining positional-only parameters, + even though many built-in functions have them (e.g. :func:`abs(x) + `). 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,11 +597,7 @@ 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 - :term:`argument`. + See :term:`argument`. provisional package A provisional package is one which has been deliberately excluded from