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

Skip to content

Commit e19e3f0

Browse files
committed
Issue #18326: merge with 3.3
2 parents 58ca93c + e1391a0 commit e19e3f0

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
@@ -601,7 +601,7 @@ Glossary
601601
parameter
602602
A named entity in a :term:`function` (or method) definition that
603603
specifies an :term:`argument` (or in some cases, arguments) that the
604-
function can accept. There are five types of parameters:
604+
function can accept. There are five kinds of parameter:
605605

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

618+
.. _keyword-only_parameter:
619+
618620
* :dfn:`keyword-only`: specifies an argument that can be supplied only
619621
by keyword. Keyword-only parameters can be defined by including a
620622
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
@@ -351,6 +351,13 @@ Tests
351351

352352
- Issue 19384: Fix test_py_compile for root user, patch by Claudiu Popa.
353353

354+
Documentation
355+
-------------
356+
357+
- Issue #18326: Clarify that list.sort's arguments are keyword-only. Also,
358+
attempt to reduce confusion in the glossary by not saying there are
359+
different "types" of arguments and parameters.
360+
354361
Build
355362
-----
356363

0 commit comments

Comments
 (0)