Skip to content

[3.8] bpo-36540: Improve doc of function definition regarding positional-only arguments (GH-25235) #25260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Doc/reference/compound_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -582,19 +582,25 @@ e.g.::
return penguin

.. index::
single: / (slash); function definition
single: * (asterisk); function definition
single: **; function definition

Function call semantics are described in more detail in section :ref:`calls`. A
function call always assigns values to all parameters mentioned in the parameter
list, either from position arguments, from keyword arguments, or from default
list, either from positional arguments, from keyword arguments, or from default
values. If the form "``*identifier``" is present, it is initialized to a tuple
receiving any excess positional parameters, defaulting to the empty tuple.
If the form "``**identifier``" is present, it is initialized to a new
ordered mapping receiving any excess keyword arguments, defaulting to a
new empty mapping of the same type. Parameters after "``*``" or
"``*identifier``" are keyword-only parameters and may only be passed
used keyword arguments.
by keyword arguments. Parameters before "``/``" are positional-only parameters
and may only be passed by positional arguments.

.. versionchanged:: 3.8
The ``/`` function parameter syntax may be used to indicate positional-only
parameters. See :pep:`570` for details.

.. index::
pair: function; annotations
Expand Down