Skip to content

Commit 162ebf0

Browse files
committed
Reword the documentation
1 parent 3e88296 commit 162ebf0

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

Doc/library/enum.rst

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -828,19 +828,21 @@ Data Types
828828

829829
.. class:: EnumDict
830830

831-
*EnumDict* is a subclass of :class:`dict` that keeps track of the order of enum members and prevents reusing member names. Use *EnumDict* when member names must be unique and their order needs to be preserved.
831+
*EnumDict* is a subclass of :class:`dict` that is used as the namespace
832+
for defining enum classes (see :ref:`prepare`).
833+
It is exposed to allow subclasses of :class:`EnumType` with advanced
834+
behavior like having multiple values per member.
835+
It prevents reusing member names, with special behavior for names that
836+
start with an underscore.
837+
838+
Note that only the :class:`~collections.abc.MutableMapping` interface
839+
(:meth:`~object.__setitem__` and :meth:`~dict.update`) is overridden.
840+
It may be possible to bypass the checks using other :class:`!dict`
841+
operations like :meth:`|= <object.__ior__>`.
832842

833843
.. attribute:: EnumDict.member_names
834844

835-
Return list of member names.
836-
837-
.. method:: EnumDict.__setitem__(self, key, value)
838-
839-
Set any item as an enum member that is not dundered and not a descriptor.
840-
841-
.. method:: EnumDict.update(self, members, **more_members)
842-
843-
Update the dictionary from the given iterable or dictionary members and more_members.
845+
A list of member names.
844846

845847
.. versionadded:: 3.13
846848

Doc/whatsnew/3.13.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,9 @@ email
745745
enum
746746
----
747747

748-
* :class:`~enum.EnumDict` has been made public in :mod:`enum`.
748+
* :class:`enum.EnumDict` has been made public, in order to allow subclasses
749+
of :class:`~enum.EnumType` with advanced behavior like having multiple values
750+
per member.
749751

750752
fractions
751753
---------
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:class:`enum.EnumDict` can now be used on its own, without resorting to
2+
private API.

0 commit comments

Comments
 (0)