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-100458: Clarify Enum.__format__() change of mixed-in types in the whatsnew/3.11.rst #100387

Merged
merged 7 commits into from
May 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -676,10 +676,10 @@ enum
* Changed :meth:`Enum.__format__() <enum.Enum.__format__>`
(the default for :func:`format`, :meth:`str.format` and :term:`f-string`\s)
of enums with mixed-in types (e.g. :class:`int`, :class:`str`)
to also include the class name in the output, not just the member's key.
to include the class name and member key in the output, not the member's value.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
to include the class name and member key in the output, not the member's value.
to show the class name and member name in the output, instead of the member's value.

This matches the existing behavior of :meth:`enum.Enum.__str__`,
returning e.g. ``'AnEnum.MEMBER'`` for an enum ``AnEnum(str, Enum)``
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
returning e.g. ``'AnEnum.MEMBER'`` for an enum ``AnEnum(str, Enum)``
returning e.g. ``'AnEnum.MEMBER'`` for an enum ``AnEnum(str, Enum)``.

instead of just ``'MEMBER'``.
instead of the member's value.
anze3db marked this conversation as resolved.
Show resolved Hide resolved

* Added a new *boundary* class parameter to :class:`~enum.Flag` enums
and the :class:`~enum.FlagBoundary` enum with its options,
Expand Down