]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.8] bpo-36540: Improve doc of function definition regarding positional-only argumen...
authorSaiyang Gou <gousaiyang@163.com>
Wed, 7 Apr 2021 19:32:24 +0000 (12:32 -0700)
committerGitHub <noreply@github.com>
Wed, 7 Apr 2021 19:32:24 +0000 (20:32 +0100)
(cherry picked from commit 58d72cab89cf9652acc0bf0007aa20b2bcc98499)

Co-authored-by: Saiyang Gou <gousaiyang@163.com>
Doc/reference/compound_stmts.rst

index 61037d97a0c3cca904e92174079450223d5cba4b..9dd471a0c83ec5b744bb72a89303c412fc9af593 100644 (file)
@@ -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