GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Document new 3.11 enum APIs (ReprEnum, global_* and/or show_flag_values) · Issue #98298 · python/cpython

Document new 3.11 enum APIs (ReprEnum, global_* and/or show_flag_values) #98298

New issue
Copy link
New issue
Copy link
Closed
Closed
Document new 3.11 enum APIs (ReprEnum, global_* and/or show_flag_values)#98298
Copy link
Assignees
ethanfurmanCAM-Gerlach
Labels
3.11only security fixesonly security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dir

Description

@CAM-Gerlach
CAM-Gerlach
opened on Oct 15, 2022
Issue body actions

As discovered in #98295 , there are several undocumented new APIs in the enum module:

  • ReprEnum and is documented in What's New (and exported in __all__), but not anywhere in the enum library module documentation, which seems like an oversight.
  • Likewise, global_enum is documented in What's New (and exported in __all__) and was previously documented in the library docs, but that documentation was reverted in bpo-40066: Revert "Revert "bpo-40066: [Enum] update str() and format() output..." #30637 , and not restored, so I'm unsure on the current status.
  • global_str, global_enum_repr and global_flag_repr were added (to replace the __str__() and __repr__() of the appropriate classes) and are not marked as private (_) and are exported by __all__, but aren't documented either. Should they be?
  • show_flag_values was added and is not in __all__, but its use is referred to in an error message (cited in the docs) and it is not marked private (_). Should this be documented as well?

@ethanfurman your guidance here would be much appreciated, thanks. I'm happy to review/copyedit a PR, or if you prefer, I can draft something and you review it. Ideally, we should get this in before the 3.11 release in a week or so...

Related: #95913

Linked PRs

  • gh-98298, gh-74730: [Enum] update docs #103163
  • [3.11] gh-98298, gh-74730: [Enum] update docs (GH-103163) #103227

Activity

  1. CAM-Gerlach
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    3.11only security fixesonly security fixes
    on Oct 15, 2022
  2. CAM-Gerlach
    assigned
    ethanfurman
    and
    CAM-Gerlach
    on Oct 15, 2022
  3. ethanfurman commented on Oct 19, 2022

    @ethanfurman
    ethanfurman
    on Oct 19, 2022
    Member
    More actions

    Working on something now. I presume I commit to main and backport to 3.11?

    Reacted by C.A.M. Gerlach
    Reacted by C.A.M. Gerlach
  4. CAM-Gerlach commented on Oct 19, 2022

    @CAM-Gerlach
    CAM-Gerlach
    on Oct 19, 2022
    MemberAuthor
    More actions

    I presume I commit to main and backport to 3.11?

    Yup 👍 Thanks!

  5. ethanfurman
    added a commit that references this issue on Oct 21, 2022

    gh-98298: [Enum] document ReprEnum, global_enum, and show_flag_values (…

    3e95ffc
  6. miss-islington
    added 2 commits that reference this issue on Oct 21, 2022

    pythongh-98298: [Enum] document ReprEnum, global_enum, and show_flag_…

    bcf4fca

    gh-98298: [Enum] document ReprEnum, global_enum, and show_flag_values (…

    31d23ae
  7. CAM-Gerlach commented on Oct 21, 2022

    @CAM-Gerlach
    CAM-Gerlach
    on Oct 21, 2022
    MemberAuthor
    More actions

    Hey @ethanfurman , are we all done here?

  8. ethanfurman commented on Oct 21, 2022

    @ethanfurman
    ethanfurman
    on Oct 21, 2022
    Member
    More actions

    @CAM-Gerlach I tihnk so.

  9. ethanfurman
    closed this as completedon Oct 21, 2022
  10. Bktero commented on Jan 12, 2023

    @Bktero
    Bktero
    on Jan 12, 2023
    More actions

    Hi!

    Inthe documentation, we can read (3.11.1) :

    @enum.global_enum
    A decorator to change the str() and repr() of an enum to show its members as belonging to the module instead of its class

    It is not said that members of the enum are also added to the global namespace. Example:

    from enum import global_enum, Enum
    
    @global_enum
    class Foo(Enum):
        BAR = 1
    
    print(BAR) # the documentation doesn't tell that this is possible

    Is this behavior a bug? Or is there something missing in the documentation?

    Reacted by C.A.M. Gerlach
  11. ethanfurman
    reopened this on Jan 12, 2023
  12. ethanfurman commented on Jan 12, 2023

    @ethanfurman
    ethanfurman
    on Jan 12, 2023
    Member
    More actions

    The behavior is intended, the docs need updating.

  13. Bktero commented on Jan 13, 2023

    @Bktero
    Bktero
    on Jan 13, 2023
    More actions

    I have been testing the almost all the new enum features yesterday, and I have other points for improving the documentation.

    Should I create a new issue or is there an existing issue I can contribute to? EDIT: this current issue is not closed, so I can add stuff here, right?

  14. ethanfurman commented on Jan 13, 2023

    @ethanfurman
    ethanfurman
    on Jan 13, 2023
    Member
    More actions

    Yes, you can link PRs to this issue. Thanks!

  15. ethanfurman
    added this to enum issueson Mar 30, 2023
  16. ethanfurman
    moved this to Docs in enum issueson Mar 30, 2023
  17. ethanfurman
    added a commit that references this issue on Apr 3, 2023

    gh-98298, gh-74730: [Enum] update docs (GH-103163)

    5ffc1e5
  18. miss-islington
    added 2 commits that reference this issue on Apr 3, 2023

    pythongh-98298, pythongh-74730: [Enum] update docs (pythonGH-103163)

    eb5abb5

    gh-98298, gh-74730: [Enum] update docs (GH-103163)

    cf72cc2
  19. ethanfurman commented on Apr 3, 2023

    @ethanfurman
    ethanfurman
    on Apr 3, 2023
    Member
    More actions

    @Bktero Closing this issue. When you have more doc updates, please open a new issue. 😄

  20. ethanfurman
    closed this as completedon Apr 3, 2023
  21. github-project-automation
    moved this from Docs to Done in enum issueson Apr 3, 2023
  22. gaogaotiantian
    added a commit that references this issue on Apr 8, 2023

    pythongh-98298, pythongh-74730: [Enum] update docs (pythonGH-103163)

    93eeed8
  23. warsaw
    added a commit that references this issue on Apr 11, 2023

    pythongh-98298, pythongh-74730: [Enum] update docs (pythonGH-103163)

    840bc8b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @CAM-Gerlach
    CAM-Gerlach
  • @ethanfurman
    ethanfurman

Labels

3.11only security fixesonly security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dir

Projects

  • enum issues
    Status
    Done
    Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.