You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PEP 3102 and PEP 570 should say **Keyword-Only Parameters** instead of **Keyword-Only Arguments** #133438
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.
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?)
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 */
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).
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.”
The only is redundant, but it makes it clearer that you can't pass the value positionally.
Activity
picnixz commentedon May 5, 2025
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?)
AA-Turner commentedon 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
StanFromIreland commentedon May 5, 2025
All occurrences in Cpython:
There are some that should be fixed.
terryjreedy commentedon May 5, 2025
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).
terryjreedy commentedon May 5, 2025
For the revised or new issue: in some cases, '-only' should be removed, resulting in 'keyword argument'; in others, s/argument/parameter, as proposed.
StanFromIreland commentedon May 5, 2025
IMO either is fine as for 2), the comments can be marked as "resolved" (or similar) hiding them.
pythongh-133438: Fix the use of the terms "argument" and "parameter" …
pythongh-133438: Fix the use of the terms "argument" and "parameter" …
serhiy-storchaka commentedon Jun 5, 2025
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.
pythongh-133438: Fix the use of the terms "argument" and "parameter" …
pythongh-133438: Fix the use of the terms "argument" and "parameter" …
encukou commentedon Jun 5, 2025
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.”
The
onlyis redundant, but it makes it clearer that you can't pass the value positionally.nedbat commentedon Mar 9, 2026
I'm closing this issue: