Skip to content

Commit 58d72ca

Browse files
authored
bpo-36540: Improve doc of function definition regarding positional-only arguments (GH-25235)
1 parent b05440c commit 58d72ca

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Doc/reference/compound_stmts.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,19 +1215,25 @@ e.g.::
12151215
return penguin
12161216

12171217
.. index::
1218+
single: / (slash); function definition
12181219
single: * (asterisk); function definition
12191220
single: **; function definition
12201221
12211222
Function call semantics are described in more detail in section :ref:`calls`. A
12221223
function call always assigns values to all parameters mentioned in the parameter
1223-
list, either from position arguments, from keyword arguments, or from default
1224+
list, either from positional arguments, from keyword arguments, or from default
12241225
values. If the form "``*identifier``" is present, it is initialized to a tuple
12251226
receiving any excess positional parameters, defaulting to the empty tuple.
12261227
If the form "``**identifier``" is present, it is initialized to a new
12271228
ordered mapping receiving any excess keyword arguments, defaulting to a
12281229
new empty mapping of the same type. Parameters after "``*``" or
12291230
"``*identifier``" are keyword-only parameters and may only be passed
1230-
used keyword arguments.
1231+
by keyword arguments. Parameters before "``/``" are positional-only parameters
1232+
and may only be passed by positional arguments.
1233+
1234+
.. versionchanged:: 3.8
1235+
The ``/`` function parameter syntax may be used to indicate positional-only
1236+
parameters. See :pep:`570` for details.
12311237

12321238
.. index::
12331239
pair: function; annotations

0 commit comments

Comments
 (0)