summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2022-08-03 14:11:20 -0700
committerGitHub <noreply@github.com>2022-08-03 14:11:20 -0700
commit6bde34000d70dfefafa71e54c8cb5672f423073c (patch)
tree1b6efdb135e5e203be2af314dfc4c4ff7fc68533
parentebd660156d80bbb17899ca393731da5548100fc1 (diff)
downloadcpython-git-6bde34000d70dfefafa71e54c8cb5672f423073c.tar.gz
[Enum] add whatsnew entries (GH-95455)
-rw-r--r--Doc/whatsnew/3.11.rst43
1 files changed, 43 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 1b3a685dba..d10d9f15a5 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -471,6 +471,49 @@ datetime
formats (barring only those that support fractional hours and minutes).
(Contributed by Paul Ganssle in :gh:`80010`.)
+enum
+----
+
+* ``EnumMeta`` renamed to ``EnumType`` (``EnumMeta`` kept as alias).
+
+* ``StrEnum`` added -- enum members are and must be strings.
+
+* ``ReprEnum`` added -- causes only the ``__repr__`` to be modified, not the
+ ``__str__`` nor the ``__format__``.
+
+* ``FlagBoundary`` added -- controls behavior when invalid values are given to
+ a flag.
+
+* ``EnumCheck`` added -- used by ``verify`` to ensure various constraints.
+
+* ``verify`` added -- function to ensure given ``EnumCheck`` constraints.
+
+* ``member`` added -- decorator to ensure given object is converted to an enum
+ member.
+
+* ``nonmember`` added -- decorator to ensure given object is not converted to
+ an enum member.
+
+* ``property`` added -- use instead of ``types.DynamicClassAttribute``.
+
+* ``global_enum`` added -- enum decorator to adjust ``__repr__`` and ``__str__``
+ to show members in the global context -- see ``re.RegexFlag`` for an example.
+
+* ``Flag`` enhancements: members support length, iteration, and containment
+ checks.
+
+* ``Enum``/``Flag`` fixes: members are now defined before ``__init_subclass__``
+ is called; ``dir()`` now includes methods, etc., from mixed-in data types.
+
+* ``Flag`` fixes: only primary values (power of two) are considered canonical
+ while composite values (3, 6, 10, etc.) are considered aliases; inverted
+ flags are coerced to their positive equivalent.
+
+* ``IntEnum`` / ``IntFlag`` / ``StrEnum`` fixes: these now inherit from
+ ``ReprEnum`` so the ``str()`` output now matches ``format()`` output,
+ which is the data types' (so both ``str(AnIntEnum.ONE)`` and
+ ``format(AnIntEnum.ONE)`` is equal to ``'1'``).
+
fractions
---------