Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
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