Title: New enum features in Python 3.11 · Issue #12841 · python/mypy · GitHub
Open Graph Title: New enum features in Python 3.11 · Issue #12841 · python/mypy
X Title: New enum features in Python 3.11 · Issue #12841 · python/mypy
Description: There's a ton of new enum features in Python 3.11 that mypy doesn't yet support: enum.property enum.verify enum.(non)member ReprEnum StrEnum enum.property is not yet supported: #12483 The new enum.verify decorator isn't supported: the fo...
Open Graph Description: There's a ton of new enum features in Python 3.11 that mypy doesn't yet support: enum.property enum.verify enum.(non)member ReprEnum StrEnum enum.property is not yet supported: #12483 The new enum....
X Description: There's a ton of new enum features in Python 3.11 that mypy doesn't yet support: enum.property enum.verify enum.(non)member ReprEnum StrEnum enum.property is not yet supported: #12483 The n...
Opengraph URL: https://github.com/python/mypy/issues/12841
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"New enum features in Python 3.11","articleBody":"There's a ton of new `enum` features in Python 3.11 that mypy doesn't yet support:\r\n\r\n- [x] `enum.property`\r\n- [ ] `enum.verify`\r\n- [x] `enum.(non)member`\r\n- [x] `ReprEnum`\r\n- [ ] `StrEnum`\r\n\r\n---\r\n\r\n`enum.property` is not yet supported:\r\n\r\n- #12483\r\n\r\n---\r\n\r\nThe new `enum.verify` decorator isn't supported: the following snippet will raise an exception at runtime on 3.11 due to not all values being unique, but it passes mypy:\r\n\r\n```python\r\nfrom enum import Enum, verify, UNIQUE\r\n\r\n@verify(UNIQUE)\r\nclass Color(Enum):\r\n RED = 1\r\n GREEN = 2\r\n BLUE = 3\r\n CRIMSON = 1\r\n```\r\n\r\n---\r\n\r\n\r\n`enum.member`/`enum.nonmember`. The docs are a bit thin on these, but it looks like in the following enum, BAR is converted to become a member, but BAZ\r\nis not:\r\n\r\n```python\r\nfrom enum import Enum, nonmember\r\n\r\nclass Foo(Enum):\r\n BAR = 1\r\n BAZ = nonmember(2)\r\n```\r\n\r\n(These two can also be used as decorators)\r\n\r\n---\r\n\r\n`ReprEnum`: this doesn't need any special support by mypy, but the following mypy bug but means that it can't really be used idiomatically at the moment:\r\n\r\n- #12787\r\n\r\n---\r\n\r\n`StrEnum`: I didn't think this required any special treatment from mypy, but there's a weird bug here in mypy's handling of `StrEnum`:\r\n\r\n- #14688","author":{"url":"https://github.com/AlexWaygood","@type":"Person","name":"AlexWaygood"},"datePublished":"2022-05-22T10:20:12Z","url":"https://github.com/python/mypy/issues/12841"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2f61ba0d-1f96-7252-c089-a52d0bcabee0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9648:43251:216056C:2C95DB1:6B005842 |
| html-safe-nonce | 380bdad9898ddda4895ef69b78c49e1cf2466a954b4ebcff9182223843f0491c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjQ4OjQzMjUxOjIxNjA1NkM6MkM5NURCMTo2QjAwNTg0MiIsInZpc2l0b3JfaWQiOiI5MTYxMTAyMzc0NDMxOTA1ODU4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d5a498ade906ac1f667fa0df32a41b8d17553e68e3a506ee2e43b40884af0e3e |
| hovercard-subject-tag | issue:1244210988 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python/mypy/12841/issue_layout |
| twitter:image | https://opengraph.githubassets.com/240017368d5672c1037505c87215e32b8d55b99ab142c033c901d8a35bdfee78/python/mypy/issues/12841 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/240017368d5672c1037505c87215e32b8d55b99ab142c033c901d8a35bdfee78/python/mypy/issues/12841 |
| og:image:alt | There's a ton of new enum features in Python 3.11 that mypy doesn't yet support: enum.property enum.verify enum.(non)member ReprEnum StrEnum enum.property is not yet supported: #12483 The new enum.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AlexWaygood |
| hostname | github.com |
| expected-hostname | github.com |
| None | 29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | eacd927ba6112e3b01ba99c762bd699a4a4f5df7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width