summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorSaiyang Gou <gousaiyang@163.com>2021-04-07 19:06:43 (GMT)
committerGitHub <noreply@github.com>2021-04-07 19:06:43 (GMT)
commit58d72cab89cf9652acc0bf0007aa20b2bcc98499 (patch)
tree5ca3e37ab3f3018bf93e3e007e4eaacda7387afe /Doc/reference
parentb05440c52b9814dbd47f679d47367e87855bd7b5 (diff)
downloadcpython-58d72cab89cf9652acc0bf0007aa20b2bcc98499.zip
cpython-58d72cab89cf9652acc0bf0007aa20b2bcc98499.tar.gz
cpython-58d72cab89cf9652acc0bf0007aa20b2bcc98499.tar.bz2
bpo-36540: Improve doc of function definition regarding positional-only arguments (GH-25235)
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/compound_stmts.rst10
1 files changed, 8 insertions, 2 deletions
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index aae7c7f..c36b50e 100644
--- a/Doc/reference/compound_stmts.rst
+++ b/Doc/reference/compound_stmts.rst
@@ -1215,19 +1215,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