Skip to content
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

gh-118650: Exclude _repr_* methods from Enum's _sunder_ reservation #118651

Merged
merged 1 commit into from
May 7, 2024

Conversation

chrysn
Copy link
Contributor

@chrysn chrysn commented May 6, 2024

This carves out some space of Enum's reserved _sunder_ names, and allows _repr_html_, _repr_pretty_ and similar methods available in IPython's pretty printing to be implemented on enums.

Closes: #118650

@chrysn chrysn requested a review from ethanfurman as a code owner May 6, 2024 14:39
@bedevere-app
Copy link

bedevere-app bot commented May 6, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Copy link
Member

@ethanfurman ethanfurman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I'll leave it open for a couple days to see if anybody else has thoughts about it.

@encukou
Copy link
Member

encukou commented May 7, 2024

It would be nice to have a naming convention for third-party projects to reserve special names.
But we don't, and using _repr_*_ for pretty-printing is quite common.

Leaving this open for days means missing Beta 1, so I'd rather merge (and revert later if necessary).

@encukou encukou merged commit 1e42842 into python:main May 7, 2024
38 checks passed
@chrysn chrysn deleted the enum-allow-_repr_html_ branch May 7, 2024 11:15
@ethanfurman
Copy link
Member

@encukou Thanks, I hadn't realized beta 1 was near.

SonicField pushed a commit to SonicField/cpython that referenced this pull request May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enum _sunder_ exclusion is overly strict
3 participants