Title: Defining _order_ in an enum class rejected · Issue #11699 · python/mypy · GitHub
Open Graph Title: Defining _order_ in an enum class rejected · Issue #11699 · python/mypy
X Title: Defining _order_ in an enum class rejected · Issue #11699 · python/mypy
Description: This generates an error, even though it's valid: from enum import Enum class E(Enum): _order_ = 'X Y' # Cannot override writable attribute "_order_" with a final one X = 1 Y = 2 According to the docs, _order_ is a somewhat magical attrib...
Open Graph Description: This generates an error, even though it's valid: from enum import Enum class E(Enum): _order_ = 'X Y' # Cannot override writable attribute "_order_" with a final one X = 1 Y = 2 According to the do...
X Description: This generates an error, even though it's valid: from enum import Enum class E(Enum): _order_ = 'X Y' # Cannot override writable attribute "_order_" with a final one X = 1 Y =...
Opengraph URL: https://github.com/python/mypy/issues/11699
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Defining _order_ in an enum class rejected","articleBody":"This generates an error, even though it's valid:\r\n\r\n```py\r\nfrom enum import Enum\r\n\r\nclass E(Enum):\r\n _order_ = 'X Y' # Cannot override writable attribute \"_order_\" with a final one\r\n X = 1\r\n Y = 2\r\n```\r\n\r\nAccording to the [docs](https://docs.python.org/3/library/enum.html#supported-sunder-names), `_order_` is a somewhat magical attribute, but it's okay to define it.\r\n\r\nThe error started happening as a side effect of #10852. \r\n\r\nIt looks like `_order_` actually isn't a valid attribute at runtime, so a potential fix would be to remove it from typeshed. If we want to do this right, we should also remove an explicit definition from the TypeInfo, since it's not available at runtime.\r\n\r\n@sobolevn What do you think?\r\n\r\nThis is a regression, so marking as high priority.","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2021-12-10T14:02:29Z","url":"https://github.com/python/mypy/issues/11699"}
| 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:ba24c615-f2d6-31b8-1975-d219176a5891 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D1E:1EBCE3:47BAA:615AD:6B004EA4 |
| html-safe-nonce | 81af72da24cddda375c1bf5ef373de45d3797dabbed8f14f34e94ccf897cf47c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDFFOjFFQkNFMzo0N0JBQTo2MTVBRDo2QjAwNEVBNCIsInZpc2l0b3JfaWQiOiI1OTQ4OTg4Mjk2NTcwMDE2MzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8a5bb842c15eed134169a4224cafc4d9748941ec08b6009f7ee6267c59fae419 |
| hovercard-subject-tag | issue:1076880658 |
| 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/11699/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4ec403ef1761cd00ea9eeabc4f76e2a6667feb4b584d5e13ec7b24236a3c5e73/python/mypy/issues/11699 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4ec403ef1761cd00ea9eeabc4f76e2a6667feb4b584d5e13ec7b24236a3c5e73/python/mypy/issues/11699 |
| og:image:alt | This generates an error, even though it's valid: from enum import Enum class E(Enum): _order_ = 'X Y' # Cannot override writable attribute "_order_" with a final one X = 1 Y = 2 According to the do... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JukkaL |
| hostname | github.com |
| expected-hostname | github.com |
| None | f9517bf360d46638a1e5e7daee7158842fe5ef43c9000afa0e127564a7c2f39b |
| 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 | b27c5dde30676028abd5c5fc53ce5c9b625f8281 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width