Skip to content
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
Prev Previous commit
Next Next commit
Point users to StrEnum or IntEnum for old formatting behavior
Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com>
  • Loading branch information
anze3db and JosephSBoyle authored Dec 27, 2022
commit 4ccc0fe0dc60e5399a9497d3229cc56cc4699c7f
2 changes: 1 addition & 1 deletion Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ enum
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 the member's value.
instead of the member's value. Those wishing to keep the old formatting behavior may wish to modify their enums with mixed-in types to inherit from one the appropriate :class:`StrEnum` or :class:`IntEnum` class.

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