Skip to content

Commit d00adac

Browse files
committed
Document EnumDict in docs and release notes
1 parent 0a26aa5 commit d00adac

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

Doc/library/enum.rst

+19-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ are not normal Python classes. See
6464
Module Contents
6565
---------------
6666

67+
:class:`EnumDict`
68+
69+
An enum class :class:`dict` that tracks order and enforces unique member names.
70+
6771
:class:`EnumType`
6872

6973
The ``type`` for Enum and its subclasses.
@@ -159,7 +163,21 @@ Data Types
159163
----------
160164

161165

162-
.. class:: EnumType
166+
.. class:: EnumDict
167+
168+
*EnumDict* is used by *EnumType* to keep track of the enum member orders and prevent reusing the member names.
169+
170+
.. attribute:: EnumDict.member_names
171+
172+
Return list of member names.
173+
174+
.. method:: EnumDict.__setitem__(self, key, value)
175+
176+
Set any item as an enum member that is not dundered and not a descriptor.
177+
178+
.. method:: EnumDict.update(self, members, **more_members)
179+
180+
Update the dictionary from the given iterable or dictionary members and more_members.
163181

164182
*EnumType* is the :term:`metaclass` for *enum* enumerations. It is possible
165183
to subclass *EnumType* -- see :ref:`Subclassing EnumType <enumtype-examples>`

Doc/whatsnew/3.13.rst

+5
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,11 @@ email
742742
(Contributed by Thomas Dwyer and Victor Stinner for :gh:`102988` to improve
743743
the :cve:`2023-27043` fix.)
744744

745+
enum
746+
----
747+
748+
* :class:`~enum.EnumDict` has been made public in :mod:`enum`.
749+
745750
fractions
746751
---------
747752

0 commit comments

Comments
 (0)