-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
gh-112328: Document EnumDict in docs and release notes #121720
Changes from 2 commits
d00adac
3bff0b9
11e2fd1
e8c368e
58fbf7b
aee56d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,12 +163,28 @@ Data Types | |
---------- | ||
|
||
|
||
.. class:: EnumType | ||
encukou marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.. class:: EnumDict | ||
|
||
*EnumDict* is used by *EnumType* to keep track of the enum member orders and prevent reusing the member names. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would start by saying what it is, not what it's used for. Ideally the documentation should also say something about when you would use this and why. I don't know why you would use it though, so I can't help with writing that explanation. |
||
|
||
.. 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>` | ||
for details. | ||
|
||
.. class:: EnumType | ||
|
||
u2rafi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``EnumType`` is responsible for setting the correct :meth:`!__repr__`, | ||
:meth:`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the | ||
final *enum*, as well as creating the enum members, properly handling | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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`. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's New should provide a quick overview to the casual reader. It might be useful to note that
Suggested change
|
||||||
|
||||||
fractions | ||||||
--------- | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.