GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — eval() documentation is wrong about keyword arguments · Issue #100546 · python/cpython

eval() documentation is wrong about keyword arguments #100546

New issue
Copy link
New issue
Copy link
Closed
Closed
eval() documentation is wrong about keyword arguments#100546
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir

Description

@wjandrea
wjandrea
opened on Dec 26, 2022
Issue body actions

Documentation

The docs for eval() say it takes keyword arguments, which is incorrect:

eval(expression, /, globals=None, locals=None)

For example:

>>> eval('a', locals={'a': 0})
  ...
TypeError: eval() takes no keyword arguments

Meanwhile, help(eval) has the correct signature:

eval(source, globals=None, locals=None, /)

I found a previous, similar issue, #69996, which was resolved in #15173 (which shipped in 3.7) but then the syntax was changed in #96579 and the same sort of mistake was added back (which shipped in 3.11).

This issue is also similar:

  • Clarify documentation of positional-only default values #67926

Linked PRs

  • gh-100546: Remove incorrect positional-only marker from eval #100547
  • [3.11] gh-100546: Remove incorrect positional-only marker from eval (GH-100547) #100654

Activity

  1. wjandrea
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Dec 26, 2022
  2. hauntsaninja commented on Dec 27, 2022

    @hauntsaninja
    hauntsaninja
    on Dec 27, 2022
    Contributor
    More actions

    Thanks for the report!

    cc @JulienPalard the history here is confusing, would you mind posting on #98340 what the current state of using positional-only (and keyword-only) markers in docs is? I still see four positional-only markers in functions.rst (though only eval's seems to be in the wrong place)

    Reacted by William Andrea
  3. hauntsaninja
    added 2 commits that reference this issue on Dec 27, 2022

    pythongh-100546: Remove incorrect positional-only marker from eval

    32673d2

    pythongh-100546: Remove incorrect positional-only marker from eval

    5f05995
  4. slateny commented on Dec 30, 2022

    @slateny
    slateny
    on Dec 30, 2022
    Contributor
    More actions

    There are some comments by Raymond on #100444, so one possible guideline for markers is the same for spelling/stylistic rules, where it just needs to be consistent per module instead of for all modules.

    That said, I think it'd nonetheless be useful to have a deeper discussion on this for consistency and properly documenting default values, whether it be via markers, or [], or otherwise.

    Reacted by Shantanu
  5. hauntsaninja
    added a commit that references this issue on Jan 1, 2023

    gh-100546: Remove incorrect positional-only marker from eval (#100547)

    71159a8
  6. miss-islington
    added 2 commits that reference this issue on Jan 1, 2023

    pythongh-100546: Remove incorrect positional-only marker from eval (p…

    13173f8

    gh-100546: Remove incorrect positional-only marker from eval (GH-100547)

    7ed7127
  7. hauntsaninja
    closed this as completedon Jan 1, 2023
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 dirDocumentation in the Doc dir

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.