Title: Cannot determine type of attribute class in base class · Issue #4956 · python/mypy · GitHub
Open Graph Title: Cannot determine type of attribute class in base class · Issue #4956 · python/mypy
X Title: Cannot determine type of attribute class in base class · Issue #4956 · python/mypy
Description: class Foo: class Thing(object): # type: ignore pass class Thing: pass class Bar: Thing = Thing class FooBar(Foo, Bar): pass scratch.py:11: error: Cannot determine type of 'Thing' in base class 'Foo' Adding object doesn't help, nor #type:...
Open Graph Description: class Foo: class Thing(object): # type: ignore pass class Thing: pass class Bar: Thing = Thing class FooBar(Foo, Bar): pass scratch.py:11: error: Cannot determine type of 'Thing' in base class 'Foo...
X Description: class Foo: class Thing(object): # type: ignore pass class Thing: pass class Bar: Thing = Thing class FooBar(Foo, Bar): pass scratch.py:11: error: Cannot determine type of 'Thing' in base cl...
Opengraph URL: https://github.com/python/mypy/issues/4956
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot determine type of attribute class in base class","articleBody":"```python\r\nclass Foo:\r\n class Thing(object): # type: ignore\r\n pass\r\n\r\nclass Thing:\r\n pass\r\n\r\nclass Bar:\r\n Thing = Thing\r\n\r\nclass FooBar(Foo, Bar):\r\n pass\r\n```\r\n\r\n> scratch.py:11: error: Cannot determine type of 'Thing' in base class 'Foo'\r\n\r\nAdding `object` doesn't help, nor `#type: ignore` as shown above.\r\n\r\nHowever, `Bar.Thing` _does_ type check; so there seems only to be a problem typing _literal_ class-valued class attributes, when inherited. (Aside: many thanks if you can tell me the proper terminology for these `Bar.Thing` and `Foo.Thing`s - it's not easy to search for!)\r\n\r\nNote `Foo.Thing` is not a problem until the inheriting class is introduced on L11.","author":{"url":"https://github.com/OJFord","@type":"Person","name":"OJFord"},"datePublished":"2018-04-23T18:51:57Z","url":"https://github.com/python/mypy/issues/4956"}
| 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:2df40565-9946-4f5b-82fe-4045b140cf62 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9A84:34D7A7:664B93:89C32C:6B00381F |
| html-safe-nonce | 4cf25839a64453ee5c5fe0e537fc55e5e8956ede138ebf2c3a09569fd04f9740 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QTg0OjM0RDdBNzo2NjRCOTM6ODlDMzJDOjZCMDAzODFGIiwidmlzaXRvcl9pZCI6IjY4ODU0MDQ1OTcxODQyNDYwNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 12c8a1d7a7f4310c0ad8fd91c49aed9614e11cbf91246c0442f1b472fa428366 |
| hovercard-subject-tag | issue:316938537 |
| 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/4956/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f50dc148beeaa483e3dd3c54c451f652987f63a0a5fd9f516354bf87e9b82001/python/mypy/issues/4956 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f50dc148beeaa483e3dd3c54c451f652987f63a0a5fd9f516354bf87e9b82001/python/mypy/issues/4956 |
| og:image:alt | class Foo: class Thing(object): # type: ignore pass class Thing: pass class Bar: Thing = Thing class FooBar(Foo, Bar): pass scratch.py:11: error: Cannot determine type of 'Thing' in base class 'Foo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | OJFord |
| 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