Skip to content
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

Incorrect example in docs for enum.Enum.__new__ #118310

Open
mmEissen opened this issue Apr 26, 2024 · 0 comments
Open

Incorrect example in docs for enum.Enum.__new__ #118310

mmEissen opened this issue Apr 26, 2024 · 0 comments
Labels
docs Documentation in the Doc dir

Comments

@mmEissen
Copy link
Contributor

mmEissen commented Apr 26, 2024

Documentation

In the documentation for 3.12 and 3.13 the example is incorrect for the documentation of enum.Enum.__new__.

Quote:

from enum import Enum
class MyIntEnum(Enum):
    SEVENTEEN = '1a', 16

results in the call int('1a', 16) and a value of 17 for the member.

Should be:

from enum import Enum
class MyIntEnum(int, Enum):
    SEVENTEEN = '1a', 16

results in the call int('1a', 16) and a value of 26 for the member.

Additionally, the code example is followed by a note which is not resolving correctly (seemingly because it is missing a space):
Screenshot 2024-04-26 at 11 30 57

Linked PRs

@mmEissen mmEissen added the docs Documentation in the Doc dir label Apr 26, 2024
encukou pushed a commit that referenced this issue May 7, 2024
The provided example was incorrect:
- The example enum was missing the `int` mixin as implied by the context
- The value of `int('1a', 16)` was incorrectly given as 17
  (should be 26)
miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 7, 2024
…118311)

The provided example was incorrect:
- The example enum was missing the `int` mixin as implied by the context
- The value of `int('1a', 16)` was incorrectly given as 17
  (should be 26)
(cherry picked from commit 48e52fe)

Co-authored-by: Momo Eissenhauer <mmEissen@users.noreply.github.com>
encukou pushed a commit that referenced this issue May 7, 2024
… (GH-118699)

gh-118310: Fix documentation for `enum.Enum.__new__` (GH-118311)

The provided example was incorrect:
- The example enum was missing the `int` mixin as implied by the context
- The value of `int('1a', 16)` was incorrectly given as 17
  (should be 26)
(cherry picked from commit 48e52fe)

Co-authored-by: Momo Eissenhauer <mmEissen@users.noreply.github.com>
SonicField pushed a commit to SonicField/cpython that referenced this issue May 8, 2024
…118311)

The provided example was incorrect:
- The example enum was missing the `int` mixin as implied by the context
- The value of `int('1a', 16)` was incorrectly given as 17
  (should be 26)
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

1 participant