8000 gh-112328: Make EnumDict usable on its own and document it by encukou · Pull Request #123669 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-112328: Make EnumDict usable on its own and document it #123669

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 13 commits into from
Dec 20, 2024
Merged
Next Next commit
Document EnumDict in docs and release notes
  • Loading branch information
u2rafi committed Jul 14, 2024
commit d00adac946aa136019f7c7ee68c0a230c4179111
20 changes: 19 additions & 1 deletion Doc/library/enum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@
Module Contents
---------------

:class:`EnumDict`

An enum class :class:`dict` that tracks order and enforces unique member names.

:class:`EnumType`

Check warning on line 71 in Doc/library/enum.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:class reference target not found: EnumType

The ``type`` for Enum and its subclasses.

Expand Down Expand Up @@ -159,7 +163,21 @@
----------


.. 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 <enumtype-examples>`
Expand Down
5 changes: 5 additions & 0 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------

Expand Down
Loading
0