Title: gh-139398: Add supported sunder names to Enum `__dir__` for REPL completions by RafaelWO · Pull Request #139985 · python/cpython · GitHub
Open Graph Title: gh-139398: Add supported sunder names to Enum `__dir__` for REPL completions by RafaelWO · Pull Request #139985 · python/cpython
X Title: gh-139398: Add supported sunder names to Enum `__dir__` for REPL completions by RafaelWO · Pull Request #139985 · python/cpython
Description: This change adds the sunder names _generate_next_value_ and _missing_ to the __dir__ method of EnumType and Enum. In Addition, The instance level sunder names _add_alias_ and _add_value_alias_ are added to Enum.__dir__. With the sunder names exposed in the dir() method, the REPL autocomplete will also show them. Note: This PR is based on the first attempt to address this issue: #139418 Preview: >>> from enum import Enum >>> Enum._ Enum._add_member_( Enum._create_( Enum._find_new_( --> Enum._missing_( Enum._check_for_existing_members_( Enum._find_data_repr_( --> Enum._generate_next_value_( Enum._convert_( Enum._find_data_type_( Enum._get_mixins_( >>> class Foo(Enum): ... BAR = 1 ... >>> Foo.BAR._ # all of the below are "new" Foo.BAR._add_alias_( Foo.BAR._add_value_alias_( Foo.BAR._generate_next_value_( Foo.BAR._missing_( Issue: gh-139398 📚 Documentation preview 📚: https://cpython-previews--139985.org.readthedocs.build/
Open Graph Description: This change adds the sunder names _generate_next_value_ and _missing_ to the __dir__ method of EnumType and Enum. In Addition, The instance level sunder names _add_alias_ and _add_value_alias_ are ...
X Description: This change adds the sunder names _generate_next_value_ and _missing_ to the __dir__ method of EnumType and Enum. In Addition, The instance level sunder names _add_alias_ and _add_value_alias_ are ...
Opengraph URL: https://github.com/python/cpython/pull/139985
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:558de379-ac20-1c35-b073-68292784a777 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D476:1A5270:2C228F3:3C5ED39:6A53E15F |
| html-safe-nonce | 8d3d02d41e70bc6d37c7b98af19fe6dbecf7363e4b31232aa7dba2a9e516ccf3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENDc2OjFBNTI3MDoyQzIyOEYzOjNDNUVEMzk6NkE1M0UxNUYiLCJ2aXNpdG9yX2lkIjoiODIyMTMxMjgxMDc4NzAwNDc2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 78aa74193dc2c8b3e40e65f9855709d9a92305dfd04ded6c9446716dcfe40c02 |
| hovercard-subject-tag | pull_request:2907323944 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/139985/files |
| twitter:image | https://avatars.githubusercontent.com/u/38643099?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/38643099?s=400&v=4 |
| og:image:alt | This change adds the sunder names _generate_next_value_ and _missing_ to the __dir__ method of EnumType and Enum. In Addition, The instance level sunder names _add_alias_ and _add_value_alias_ are ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width