Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enum _sunder_ exclusion is overly strict #118650

Closed
Labels
type-featureA feature request or enhancement
@chrysn

Description

@chrysn

Bug report

Bug description:

Enums' exclusive access to _sunder_ members inhibits their use with the IPython/Jupyter pattern of making HTML and other visual reprs available:

fromenumimportEnumclassMyEnum(Enum):A=1def_repr_html_(self):returnf'<span title="A MyEnum">{self}</abbr>'# ValueError: _sunder_ names, such as '_repr_html_', are reserved for future Enum use

While having exclusive access to some space is valuable, and prefixing enum's range is not practical (as that prefix would need to be repeated by users constructing the class), carving out some space for widespread functions that are not expected to conflict with Enum's internal use should be possible. I suggest that at least_repr_html_ should be allowed, possibly the whole_repr_ prefix.

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp