Skip to content

Document in the main Enum page that super().__new__ should not be called #115821

Closed
@Gouvernathor

Description

@Gouvernathor

The HowTo page says here that super().__new__ should not be called in user-defined __new__ methods of an Enum (subclass), along with a short explanation for why it is the case.

But this is a hard limitation, not a bonus explanation. When I tried using the super, I ended up with an exception I didn't understand and the doc entry for Enum.__new__ didn't help me at all as per why that was failing.

The explanation should probably remain in the howto page, but a similar red warning should be added to Enum.__new__, saying that calling super().__new__ inside user-defined __new__ functions is forbidden.

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