Title: 'Final' (PEP 591) shouldn't apply to '__private' symbols · Issue #9910 · python/mypy · GitHub
Open Graph Title: 'Final' (PEP 591) shouldn't apply to '__private' symbols · Issue #9910 · python/mypy
X Title: 'Final' (PEP 591) shouldn't apply to '__private' symbols · Issue #9910 · python/mypy
Description: Bug Report Since __private symbols are not shared between classes, I think we shouldn't complain if a symbol (either variable or method) that's declared Final or @final is redefined in a subclass. If you agree, we should probably add som...
Open Graph Description: Bug Report Since __private symbols are not shared between classes, I think we shouldn't complain if a symbol (either variable or method) that's declared Final or @final is redefined in a subclass. ...
X Description: Bug Report Since __private symbols are not shared between classes, I think we shouldn't complain if a symbol (either variable or method) that's declared Final or @final is redefined in a su...
Opengraph URL: https://github.com/python/mypy/issues/9910
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"'Final' (PEP 591) shouldn't apply to '__private' symbols","articleBody":"**Bug Report**\r\n\r\nSince `__private` symbols are not shared between classes, I think we shouldn't complain if a symbol (either variable or method) that's declared `Final` or `@final` is redefined in a subclass. If you agree, we should probably add something to PEP 591 about this.\r\n\r\n**To Reproduce**\r\n\r\n```py\r\nfrom typing import Final, final\r\n\r\nclass Parent:\r\n __foo: Final[int] = 0\r\n\r\n @final\r\n def __bar(self) -> None:\r\n pass\r\n\r\nclass Child(Parent):\r\n __foo: Final[int] = 1 # error: Cannot override final attribute \"__foo\" (previously declared in base class \"Parent\")\r\n\r\n @final # error: Cannot override final attribute \"__bar\" (previously declared in base class \"Parent\")\r\n def __bar(self) -> None:\r\n pass\r\n```\r\n\r\n**Expected Behavior**\r\n\r\nNo errors.\r\n\r\n**Your Environment**\r\n\r\n\u003c!-- Include as many relevant details about the environment you experienced the bug in -->\r\n\r\n- Mypy version used: 0.800+dev.37d2a5ff7a245e58af18a84e04581ccddbfb8414\r\n- Mypy command-line flags: none\r\n- Mypy configuration options from `mypy.ini` (and other config files): nothing\r\n- Python version used: 3.9\r\n- Operating system and version: Windows 10\r\n","author":{"url":"https://github.com/gvanrossum","@type":"Person","name":"gvanrossum"},"datePublished":"2021-01-14T04:36:18Z","url":"https://github.com/python/mypy/issues/9910"}
| 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:8e464382-e5d2-47eb-61eb-2f0f56b276b6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A148:145630:2F0C6B1:3E54DCA:6B0029C9 |
| html-safe-nonce | 21bb44be1ee655584f148c0458f8341e0483ec4c1387807d1968e2ef4f37dc5a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTQ4OjE0NTYzMDoyRjBDNkIxOjNFNTREQ0E6NkIwMDI5QzkiLCJ2aXNpdG9yX2lkIjoiNjg5OTM3ODcwODA5Njc1NjE2OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7d1495d4d5f1f6b6ab696f1c8d4005b4dcaaf21d4f597fe03f049587684569b7 |
| hovercard-subject-tag | issue:785643481 |
| 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/9910/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d12485cca5eb2bdf196c6ec710425fd4f60acf091ea7b4a6eb1e742c7d2d9b70/python/mypy/issues/9910 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d12485cca5eb2bdf196c6ec710425fd4f60acf091ea7b4a6eb1e742c7d2d9b70/python/mypy/issues/9910 |
| og:image:alt | Bug Report Since __private symbols are not shared between classes, I think we shouldn't complain if a symbol (either variable or method) that's declared Final or @final is redefined in a subclass. ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gvanrossum |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width