The Wayback Machine - https://web.archive.org/web/20250903025846/https://github.com/python/cpython/pull/118651
Skip to content

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.

@chrysn chrysn force-pushed the enum-allow-_repr_html_ branch from 3651668 to 4f38131 Compare May 6, 2024 14:53
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
@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
3 participants