Skip to content

docs: Fix enum reassign str documentation #101507

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

Merged
merged 1 commit into from
Feb 2, 2023
Merged

docs: Fix enum reassign str documentation #101507

merged 1 commit into from
Feb 2, 2023

Conversation

gesslerpd
Copy link
Contributor

Previous documentation didn't show correct reassignment to restore 3.10 enum str behavior.

@ghost
Copy link

ghost commented Feb 1, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-bot bedevere-bot added awaiting review docs Documentation in the Doc dir skip news labels Feb 1, 2023
@gesslerpd
Copy link
Contributor Author

gesslerpd commented Feb 1, 2023

Is it possible to revert the IntEnum str change for the next 3.11 PATCH to not inherit from ReprEnum? Logging/code generation using the changed IntEnum.__str__ becomes much less informational, especially for interfaces that don't control how/where the IntEnums are defined and want to display the most informational str possible. I can see why the newly added StrEnum benefits greatly from ReprEnum but not so much for existing applications using IntEnum as informational str relying on the previous behavior.

@ethanfurman
Copy link
Member

Unfortunately, no. Using ReprEnum is basically a bug-fix for all the code switching from actual ints to IntEnum, as that code expects to have 5 and not SomeEnum.PENTAGON for the str value.

As for logging and error reporting, it's been my experience so far that that should almost always use repr.

@gesslerpd
Copy link
Contributor Author

@ethanfurman Thanks for the reply, will try to use these mixin techniques where I'm unable to use repr such as nested pretty printing. As for this docs change I'm unable to add the "skip issue" label myself to pass the checks

@ethanfurman ethanfurman added skip issue 3.11 only security fixes 3.12 only security fixes needs backport to 3.11 only security fixes labels Feb 2, 2023
@ethanfurman ethanfurman merged commit 24cbc7a into python:main Feb 2, 2023
@miss-islington
Copy link
Contributor

Thanks @gesslerpd for the PR, and @ethanfurman for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-101518 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Feb 2, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 2, 2023
(cherry picked from commit 24cbc7a)

Co-authored-by: Peter Gessler <gesslerpd@users.noreply.github.com>
miss-islington added a commit that referenced this pull request Feb 2, 2023
(cherry picked from commit 24cbc7a)

Co-authored-by: Peter Gessler <gesslerpd@users.noreply.github.com>
@gesslerpd gesslerpd deleted the gesslerpd-patch-1 branch February 3, 2023 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 only security fixes docs Documentation in the Doc dir skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants