diff options
author | Zachary Ware <zachary.ware@gmail.com> | 2013-11-22 19:58:34 (GMT) |
---|---|---|
committer | Zachary Ware <zachary.ware@gmail.com> | 2013-11-22 19:58:34 (GMT) |
commit | e1391a0d68b063adfb13a48756938d19cc67c7e0 (patch) | |
tree | 1bc22fe102e51eeb520f9cc689041306da0d964b | |
parent | 0b1386d9221f6e75a751e189c5d578c9c2fb1923 (diff) | |
download | cpython-e1391a0d68b063adfb13a48756938d19cc67c7e0.zip cpython-e1391a0d68b063adfb13a48756938d19cc67c7e0.tar.gz cpython-e1391a0d68b063adfb13a48756938d19cc67c7e0.tar.bz2 |
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.
-rw-r--r-- | Doc/glossary.rst | 6 | ||||
-rw-r--r-- | Doc/library/stdtypes.rst | 3 | ||||
-rw-r--r-- | Misc/NEWS | 7 |
3 files changed, 14 insertions, 2 deletions
diff --git a/Doc/glossary.rst b/Doc/glossary.rst index b4465ac..71e4686 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -41,7 +41,7 @@ Glossary argument A value passed to a :term:`function` (or :term:`method`) when calling the - function. There are two types of arguments: + function. There are two kinds of argument: * :dfn:`keyword argument`: an argument preceded by an identifier (e.g. ``name=``) in a function call or passed as a value in a dictionary @@ -592,7 +592,7 @@ Glossary parameter A named entity in a :term:`function` (or method) definition that specifies an :term:`argument` (or in some cases, arguments) that the - function can accept. There are five types of parameters: + function can accept. There are five kinds of parameter: * :dfn:`positional-or-keyword`: specifies an argument that can be passed either :term:`positionally <argument>` or as a :term:`keyword argument @@ -606,6 +606,8 @@ Glossary parameters. However, some built-in functions have positional-only parameters (e.g. :func:`abs`). + .. _keyword-only_parameter: + * :dfn:`keyword-only`: specifies an argument that can be supplied only by keyword. Keyword-only parameters can be defined by including a single var-positional parameter or bare ``*`` in the parameter list diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index fa58a0d..db3ef88 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1149,6 +1149,9 @@ application). fail, the entire sort operation will fail (and the list will likely be left in a partially modified state). + :meth:`sort` accepts two arguments that can only be passed by keyword + (:ref:`keyword-only arguments <keyword-only_parameter>`): + *key* specifies a function of one argument that is used to extract a comparison key from each list element (for example, ``key=str.lower``). The key corresponding to each item in the list is calculated once and @@ -68,6 +68,13 @@ Tests - Issue #19085: Added basic tests for all tkinter widget options. +Documentation +------------- + +- 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. + Build ----- |