Repository navigation
PEP 3102 and PEP 570 should say **Keyword-Only Parameters** instead of **Keyword-Only Arguments** #133438
Description
Activity
PEPs are historical documents that won't get updates like that and thus they may contain typos or errors. We don't have a policy of publishing erratas though (@AA-Turner maybe it'd be good to have an errata policy?)
- addedpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
on May 5, 2025 Is there anywhere that the error appears in the current documentation? As Ben says, as a
rule we don't tend to update Final PEPs.A
All occurrences in Cpython:
Modules/_testcapi/getargs.c:/* test PyArg_ParseTupleAndKeywords keyword-only arguments */ Doc/c-api/arg.rst: keyword-only. Currently, all keyword-only arguments must also be optional Doc/whatsnew/3.0.rst:* :pep:`3102`: Keyword-only arguments. Named parameters occurring Doc/whatsnew/3.0.rst: argument list, but you do have keyword-only arguments. Doc/whatsnew/3.4.rst:keyword-only arguments. It also provides some efficiency improvements. Doc/whatsnew/3.4.rst:* Defaults for keyword-only arguments are now evaluated *after* defaults for Doc/library/unittest.mock.rst: Added two keyword-only arguments to the reset_mock function. Doc/library/exceptions.rst: The optional *name* and *path* keyword-only arguments Doc/library/functions.rst: There are two optional keyword-only arguments. The *key* argument specifies Doc/library/functions.rst: There are two optional keyword-only arguments. The *key* argument specifies Doc/library/inspect.rst: Example: print all keyword-only arguments without default values: Doc/library/collections.rst: :ref:`keyword-only arguments <keyword-only_parameter>`. Doc/library/stdtypes.rst: (:ref:`keyword-only arguments <keyword-only_parameter>`): Doc/library/ast.rst: * ``kw_defaults`` is a list of default values for keyword-only arguments. If Doc/library/pickle.rst: class requires keyword-only arguments. Otherwise, it is recommended for Doc/library/subprocess.rst: be set by passing them as keyword-only arguments. Doc/tutorial/controlflow.rst:Keyword-Only Arguments Misc/HISTORY: missing keyword-only arguments. Patch by Jeremiah Lowin. Misc/HISTORY:- Issue #20619: Give the AST nodes of keyword-only arguments a column and line Misc/HISTORY:- Issue #14607: Fix keyword-only arguments which started with ``__``. Misc/HISTORY:- Issue #12356: When required positional or keyword-only arguments are not Misc/HISTORY:- PEP 3102: keyword-only arguments. Misc/NEWS.d/3.5.0a3.rst:of instances of classes whose __new__ method takes keyword-only arguments. Misc/NEWS.d/3.12.0a1.rst:missing keyword-only arguments. Misc/NEWS.d/3.10.0b1.rst:will become keyword-only arguments to the generated __init__. Misc/NEWS.d/3.5.0a1.rst:keyword-only arguments. Patch by Jeremiah Lowin. Lib/_ast_unparse.py: # varargs, or bare '*' if no varargs but keyword-only arguments present Lib/_ast_unparse.py: # keyword-only arguments Lib/pydoc_data/topics.py: keyword (keyword-only arguments): Lib/test/test_positional_only_arg.py: with self.assertRaisesRegex(TypeError, r"missing 2 required keyword-only arguments: 'd' and 'e'"): Lib/test/test_positional_only_arg.py: r"\(and 2 keyword-only arguments\) were given"): Lib/test/test_extcall.py: TypeError: f() takes 0 positional arguments but 3 positional arguments (and 2 keyword-only arguments) were given Lib/test/test_extcall.py: TypeError: f() missing 5 required keyword-only arguments: 'a', 'b', 'c', 'd', and 'e' Lib/test/test_keywordonlyarg.py: # more than 255 keyword-only arguments, should compile ok Lib/inspect.py: 'args' is the list of argument names. Keyword-only arguments are Lib/inspect.py: # keyword-only arguments Lib/inspect.py: Parameter objects (keyword-only arguments are in the same order Lib/inspect.py: # a '*' to separate keyword-only arguments Lib/copyreg.py: keyword-only arguments to be pickled correctly. Python/ast_unparse.c: /* vararg, or bare '*' if no varargs but keyword-only arguments present */ Python/ast_unparse.c: /* keyword-only arguments */There are some that should be fixed.
I think we should generally continue the policy of leaving PEPs as historical docs. In particular, I don't think this issue should be an exception. So either 1) this issue should be closed and a new one opened, with Stan's list copied over; or 2) the title and initial comment should be revised (but then following comments, including this, would not fit). I suggest 1).
For the revised or new issue: in some cases, '-only' should be removed, resulting in 'keyword argument'; in others, s/argument/parameter, as proposed.
Reacted by Serhiy Storchaka- the title and initial comment should be revised (but then following comments, including this, would not fit). I suggest 1).
IMO either is fine as for 2), the comments can be marked as "resolved" (or similar) hiding them.
There are many other cases of misusing "argument" and "parameter".
#135160 fixes the use of the terms "argument" and "parameter" in the documentation. A following PR will fix also error messages and output.
FWIW, I'd keep the phrase keyword-only argument in (most) places where we're really talking about arguments, like “This function accepts a keyword-only foo argument.”
Theonlyis redundant, but it makes it clearer that you can't pass the value positionally.- removedpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
on Jun 7, 2025 I'm closing this issue:
- PEPs generally are not changed after they are accepted
- If we were to change a PEP, we'd do it in https://github.com/python/peps, not this repo
- The distinction between arguments and parameters is mostly pedantic, and sometimes depends on your perspective
- Litigating every "argument" and "parameter" to decide which is right is a lot of work with little benefit. See gh-133438: Fix the use of the terms "argument" and "parameter" in the documentation #135160 for discussion of this.
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsTodo
PEP 3102 and PEP 570 say Keyword-Only Arguments but they should say Keyword-Only Parameters because a keyword-only parameter is the parameter which only accepts a keyword argument.
Actually, PEP 570 correctly says Positional-Only Parameters because a positional-only parameter is the parameter which only accepts a positional argument.
Glossary explains a keyword argument and positional argument.
Linked PRs