8000 gh-95913: Copyedit, xref and organize enum section by CAM-Gerlach · Pull Request #98295 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-95913: Copyedit, xref and organize enum section #98295

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 5 commits into from
Oct 18, 2022
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
Whatsnew: Combine directly related enum items instead of seperating them
  • Loading branch information
CAM-Gerlach committed Oct 15, 2022
commit 1ddd452d6125123f3840e80e5976022dd2b61322
36 changes: 14 additions & 22 deletions Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -634,24 +634,21 @@ enum
* Added :class:`~enum.ReprEnum`,
which only modifies the :meth:`~object.__repr__` of members
while returning just their values for
:meth:`~object.__str__` and :meth:`~object.__format__`
:meth:`~object.__str__` and :meth:`~object.__format__`.
:class:`~enum.IntEnum`, :class:`~enum.IntFlag` and :class:`~enum.StrEnum`
now inherit from it, so their :func:`str` output now matches :func:`format`
(both ``str(AnIntEnum.ONE)`` and ``format(AnIntEnum.ONE)`` return ``'1'``).

* Added the :class:`~enum.FlagBoundary` enum,
containing the options for the *behavior* class parameter
to :class:`~enum.Flag` enums, controlling how to handle out-of-range values.
* Added a new *boundary* class parameter to :class:`~enum.Flag` enums
and the :class:`~enum.FlagBoundary` enum with its options,
to control how to handle out-of-range flag values.

* Added the :class:`~enum.EnumCheck` enum,
containing the flags to pass to the :meth:`~enum.verify` decorator
to control what constraints are checked.
* Added the :func:`~enum.verify` enum decorator
and the :class:`~enum.EnumCheck` enum with its options,
to check enum classes against several specific constraints.

* Added the :func:`~enum.verify` enum decorator,
to check the passed :class:`~enum.EnumCheck` constraints.

* Added the :func:`~enum.member` decorator,
to ensure the decorated object is converted to an enum member.

* Added the :func:`~enum.nonmember` decorator,
to ensure the decorated object is not converted to an enum member.
* Added the :func:`~enum.member` and :func:`~enum.nonmember` decorators,
to ensure the decorated object is/is not converted to an enum member.

* Added the :func:`~enum.property` decorator,
which works like :func:`property` except for enums.
Expand All @@ -663,8 +660,8 @@ enum
For example, ``'re.ASCII'`` for the :data:`~re.ASCII` member
of :class:`re.RegexFlag` rather than ``'RegexFlag.ASCII'``.

* Enhanced :class:`~enum.Flag`
to support length, iteration, and contains checks on its members.
* Enhanced :class:`~enum.Flag` to support
:func:`len`, iteration and :keyword:`in`/:keyword:`not in` on its members.

* Changed :class:`~enum.Enum` and :class:`~enum.Flag`
so that members are now defined
Expand All @@ -676,11 +673,6 @@ enum
while composite values (``3``, ``6``, ``10``, etc.) are considered aliases;
inverted flags are coerced to their positive equivalent.

* Changed :class:`~enum.IntEnum`, :class:`~enum.IntFlag` and :class:`~enum.StrEnum`
to inherit from :class:`~enum.ReprEnum`
so the :func:`str` output now matches :func:`format` output,
which is just the default string representation of their values
(so both ``str(AnIntEnum.ONE)`` and ``format(AnIntEnum.ONE)`` return ``'1'``).

fractions
---------
Expand Down
11 0