Skip to content

gh-136672: Docs: Move Enum functions and add examples #136791

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

RafaelWO
Copy link
Contributor

@RafaelWO RafaelWO commented Jul 19, 2025

When the Enum functions _add_alias_ and _add_value_alias_ were added in de6bca9, the documentation for them was done under EnumType instead of Enum.

This change moves them to the docs of the Enum class and adds an example for each function.

Additionally, it moves the versionadded for EnumType to the top and fixes the indentation of another versionchanged entry.


📚 Documentation preview 📚: https://cpython-previews--136791.org.readthedocs.build/

@RafaelWO
Copy link
Contributor Author

Thanks for reviewing, @AA-Turner 🙃

RafaelWO added 2 commits July 19, 2025 13:31
When the `Enum` functions `_add_alias_` and `_add_value_alias_` were added in de6bca9, the documentation for them was done under `EnumType` instead of `Enum`.

This change moves them to the docs of the `Enum` class and adds an example for each function.
This change moves the `versionadded` for `EnumType` to the top.
Additionally, it fixes the indentation of another `versionchanged` entry.
@RafaelWO RafaelWO force-pushed the change/docs-move-enum-functions-and-add-examples branch from 69e75be to 4b25a5f Compare July 19, 2025 11:31
Copy link
Member

@ethanfurman ethanfurman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly good, just one small change.

Comment on lines 881 to 884
- :meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing
member.
- :meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an
- :meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an
existing member.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move these lines to the bottom of the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

@bedevere-app
Copy link

bedevere-app bot commented Jul 19, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@AA-Turner AA-Turner added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jul 19, 2025
Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @RafaelWO! Please could you have a look at Ethan's suggestions.

A

@RafaelWO RafaelWO marked this pull request as draft July 20, 2025 08:56
@RafaelWO
Copy link
Contributor Author

RafaelWO commented Jul 20, 2025

Upon fixing the ordering of the methods under "Supported _sunder_ names", I noticed that this section and the above ("Supported __dunder__ names") are duplicated in the enum API docs and enum HOWTO - but they are not in sync.

Is there a way to connect those sections (i.e. include the content to have only one source of truth)? Or should I just remove one, e.g., in the HOWTO, and link to the other one?

Thanks for your suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes skip news sprint
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants