Skip to content

PEP 3102 and PEP 570 should say **Keyword-Only Parameters** instead of **Keyword-Only Arguments** #133438

Description

@hyperkai

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

Activity

  1. picnixz commented on May 5, 2025

    @picnixz
    Member

    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?)

  2. added
    pendingThe issue will be closed if no feedback is provided
    on May 5, 2025
  3. AA-Turner commented on May 5, 2025

    @AA-Turner
    Member

    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

  4. StanFromIreland commented on May 5, 2025

    @StanFromIreland
    Member

    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.

  5. terryjreedy commented on May 5, 2025

    @terryjreedy
    Member

    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).

  6. terryjreedy commented on May 5, 2025

    @terryjreedy
    Member

    For the revised or new issue: in some cases, '-only' should be removed, resulting in 'keyword argument'; in others, s/argument/parameter, as proposed.

  7. StanFromIreland commented on May 5, 2025

    @StanFromIreland
    Member
    1. 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.

  8. added 2 commits that reference this issue on Jun 5, 2025
  9. serhiy-storchaka commented on Jun 5, 2025

    @serhiy-storchaka
    Member

    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.

  10. added 2 commits that reference this issue on Jun 5, 2025
  11. encukou commented on Jun 5, 2025

    @encukou
    Member

    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.

  12. removed
    pendingThe issue will be closed if no feedback is provided
    on Jun 7, 2025
  13. nedbat commented on Mar 9, 2026

    @nedbat
    Member

    I'm closing this issue:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions