Skip to content

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

Closed
@mmEissen

Description

@mmEissen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions