gh-118761: Use `enum._simple_enum` for `annotationlib.Format` by AA-Turner · Pull Request #132031 · python/cpython · GitHub
Skip to content

gh-118761: Use enum._simple_enum for annotationlib.Format - #132031

Closed
AA-Turner wants to merge 1 commit into
python:mainfrom
AA-Turner:annotationlib-simple-enum
Closed

AA-Turner wants to merge 1 commit into
python:mainfrom
AA-Turner:annotationlib-simple-enum

Conversation

@AA-Turner

@AA-Turner AA-Turner commented Apr 2, 2025

Copy link
Copy Markdown
Member

We can use the internal _simple_enum class decorator here, for slight faster enum creation. I don't think there's any good way to entirely avoid/defer the enum import, though.

A

@JelleZijlstra

Copy link
Copy Markdown
Member

@AA-Turner

Copy link
Copy Markdown
Member Author

My understanding is it's an intentionally internal-only decorator (eg used in ast and re). @ethanfurman is probably best placed to comment.

A

@python-cla-bot

python-cla-bot Bot commented Apr 6, 2025

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@JelleZijlstra

Copy link
Copy Markdown
Member

I don't want to do this. If we think creating enum classes is too slow, we should make a public API for faster enums.

@ethanfurman

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants