-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Enum _sunder_ exclusion is overly strict #118650
Comments
The current sundar section makes no mention of a blanket preemption, but does doc that there have been additions, implying possible future additions. There is one current use of a name with internal underscores. This might be classified as I think the restriction should be loosened at least in 3.13 if possible and documented whatever it is in each version. |
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:
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
_repr_*
methods from Enum's _sunder_ reservation #118651Enum._repr_*
reservation exclusion #118698The text was updated successfully, but these errors were encountered: