Title: Base class attribute type does not provide type context in subclass · Issue #4547 · python/mypy · GitHub
Open Graph Title: Base class attribute type does not provide type context in subclass · Issue #4547 · python/mypy
X Title: Base class attribute type does not provide type context in subclass · Issue #4547 · python/mypy
Description: In this example there is an unnecessary message about needing a type annotation: from typing import List class A: x: List[str] class B(A): x = [] # Need type annotation Here we should we able to use the base class type for x as type cont...
Open Graph Description: In this example there is an unnecessary message about needing a type annotation: from typing import List class A: x: List[str] class B(A): x = [] # Need type annotation Here we should we able to us...
X Description: In this example there is an unnecessary message about needing a type annotation: from typing import List class A: x: List[str] class B(A): x = [] # Need type annotation Here we should we able to us...
Opengraph URL: https://github.com/python/mypy/issues/4547
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Base class attribute type does not provide type context in subclass","articleBody":"In this example there is an unnecessary message about needing a type annotation:\r\n\r\n```py\r\nfrom typing import List\r\n\r\nclass A:\r\n x: List[str]\r\n\r\nclass B(A):\r\n x = [] # Need type annotation\r\n```\r\n\r\nHere we should we able to use the base class type for `x` as type context for the `x` initializer.\r\n\r\nThis is closely related to #3208.","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2018-02-07T16:51:35Z","url":"https://github.com/python/mypy/issues/4547"}
| 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:2e3410d2-ff18-9fa1-4c87-6e5ab8428854 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B0C2:CEC0A:356F854:470F7E4:6B00468C |
| html-safe-nonce | a8a37134b1ebcb279a47d34588730fdbb16a494b4ebdf47bf14aebcea3ad4236 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMEMyOkNFQzBBOjM1NkY4NTQ6NDcwRjdFNDo2QjAwNDY4QyIsInZpc2l0b3JfaWQiOiIxNTc3MzIzODQ2NDQzMjIyNjY4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1f5a82c7cb8f792a452f662eba1a45e8a3064060a985bc4830b0e7711a6bac90 |
| hovercard-subject-tag | issue:295212156 |
| 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/4547/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2644387eb3cfa2012965c1657ee0c8a769f05c2c2b49cb3330ad19eb4e77df80/python/mypy/issues/4547 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2644387eb3cfa2012965c1657ee0c8a769f05c2c2b49cb3330ad19eb4e77df80/python/mypy/issues/4547 |
| og:image:alt | In this example there is an unnecessary message about needing a type annotation: from typing import List class A: x: List[str] class B(A): x = [] # Need type annotation Here we should we able to us... |
| 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 | 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