Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e1391a0

Browse files
committed
Issue #18326: Clarify that list.sort's arguments are keyword-only.
Also, attempt to reduce confusion in the glossary by not saying there are different "types" of arguments and parameters.
1 parent 0b1386d commit e1391a0

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

Doc/glossary.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Glossary
4141

4242
argument
4343
A value passed to a :term:`function` (or :term:`method`) when calling the
44-
function. There are two types of arguments:
44+
function. There are two kinds of argument:
4545

4646
* :dfn:`keyword argument`: an argument preceded by an identifier (e.g.
4747
``name=``) in a function call or passed as a value in a dictionary
@@ -592,7 +592,7 @@ Glossary
592592
parameter
593593
A named entity in a :term:`function` (or method) definition that
594594
specifies an :term:`argument` (or in some cases, arguments) that the
595-
function can accept. There are five types of parameters:
595+
function can accept. There are five kinds of parameter:
596596

597597
* :dfn:`positional-or-keyword`: specifies an argument that can be passed
598598
either :term:`positionally <argument>` or as a :term:`keyword argument
@@ -606,6 +606,8 @@ Glossary
606606
parameters. However, some built-in functions have positional-only
607607
parameters (e.g. :func:`abs`).
608608

609+
.. _keyword-only_parameter:
610+
609611
* :dfn:`keyword-only`: specifies an argument that can be supplied only
610612
by keyword. Keyword-only parameters can be defined by including a
611613
single var-positional parameter or bare ``*`` in the parameter list

Doc/library/stdtypes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,9 @@ application).
11491149
fail, the entire sort operation will fail (and the list will likely be left
11501150
in a partially modified state).
11511151

1152+
:meth:`sort` accepts two arguments that can only be passed by keyword
1153+
(:ref:`keyword-only arguments <keyword-only_parameter>`):
1154+
11521155
*key* specifies a function of one argument that is used to extract a
11531156
comparison key from each list element (for example, ``key=str.lower``).
11541157
The key corresponding to each item in the list is calculated once and

Misc/NEWS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ Tests
6868

6969
- Issue #19085: Added basic tests for all tkinter widget options.
7070

71+
Documentation
72+
-------------
73+
74+
- Issue #18326: Clarify that list.sort's arguments are keyword-only. Also,
75+
attempt to reduce confusion in the glossary by not saying there are
76+
different "types" of arguments and parameters.
77+
7178
Build
7279
-----
7380

0 commit comments

Comments
 (0)