Skip to content

eval() documentation is wrong about keyword arguments #100546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wjandrea opened this issue Dec 26, 2022 · 2 comments
Closed

eval() documentation is wrong about keyword arguments #100546

wjandrea opened this issue Dec 26, 2022 · 2 comments
Labels
docs Documentation in the Doc dir

Comments

@wjandrea
Copy link
Contributor

wjandrea commented Dec 26, 2022

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:

Linked PRs

@wjandrea wjandrea added the docs Documentation in the Doc dir label Dec 26, 2022
@hauntsaninja
Copy link
Contributor

hauntsaninja commented Dec 27, 2022

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)

hauntsaninja added a commit to hauntsaninja/cpython that referenced this issue Dec 27, 2022
All the arguments are positional-only.

The current status after python#99476 seems to be to not use positional-only
markers in documentation (although there are still three others in this
file). I asked for clarification in
python#100546 (comment).
hauntsaninja added a commit to hauntsaninja/cpython that referenced this issue Dec 27, 2022
All the arguments are positional-only.

The current status after python#99476 seems to be to not use positional-only
markers in documentation, hence I've simply removed it.

That said, there are still three other positional-only markers in this
file).  I asked for clarification in
python#100546 (comment).
See also python#98340
@slateny
Copy link
Contributor

slateny commented Dec 30, 2022

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.

hauntsaninja added a commit that referenced this issue Jan 1, 2023
All the arguments are positional-only.

The current status after #99476 seems to be to not use positional-only
markers in documentation, hence I've simply removed it.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 1, 2023
…ythonGH-100547)

All the arguments are positional-only.

The current status after pythonGH-99476 seems to be to not use positional-only
markers in documentation, hence I've simply removed it.
(cherry picked from commit 71159a8)

Co-authored-by: Shantanu <[email protected]>
miss-islington added a commit that referenced this issue Jan 1, 2023
All the arguments are positional-only.

The current status after GH-99476 seems to be to not use positional-only
markers in documentation, hence I've simply removed it.
(cherry picked from commit 71159a8)

Co-authored-by: Shantanu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

3 participants