From d00adac946aa136019f7c7ee68c0a230c4179111 Mon Sep 17 00:00:00 2001 From: Rafi Date: Sun, 14 Jul 2024 10:17:19 +0200 Subject: [PATCH] Document EnumDict in docs and release notes --- Doc/library/enum.rst | 20 +++++++++++++++++++- Doc/whatsnew/3.13.rst | 5 +++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index 8b3f397ea862f4..8192d270208381 100644 --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -64,6 +64,10 @@ are not normal Python classes. See Module Contents --------------- + :class:`EnumDict` + + An enum class :class:`dict` that tracks order and enforces unique member names. + :class:`EnumType` The ``type`` for Enum and its subclasses. @@ -159,7 +163,21 @@ Data Types ---------- -.. class:: EnumType +.. class:: EnumDict + + *EnumDict* is used by *EnumType* to keep track of the enum member orders and prevent reusing the member names. + + .. attribute:: EnumDict.member_names + + Return list of member names. + + .. method:: EnumDict.__setitem__(self, key, value) + + Set any item as an enum member that is not dundered and not a descriptor. + + .. method:: EnumDict.update(self, members, **more_members) + + Update the dictionary from the given iterable or dictionary members and more_members. *EnumType* is the :term:`metaclass` for *enum* enumerations. It is possible to subclass *EnumType* -- see :ref:`Subclassing EnumType ` diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 4a9a0b77d068b3..97e64abc9c8beb 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -742,6 +742,11 @@ email (Contributed by Thomas Dwyer and Victor Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.) +enum +---- + +* :class:`~enum.EnumDict` has been made public in :mod:`enum`. + fractions ---------