Title: Callable ClassVar is incorrectly treated as a method · Issue #11077 · python/mypy · GitHub
Open Graph Title: Callable ClassVar is incorrectly treated as a method · Issue #11077 · python/mypy
X Title: Callable ClassVar is incorrectly treated as a method · Issue #11077 · python/mypy
Description: from typing import Callable, MutableMapping, ClassVar class C: x: ClassVar[Callable[[], MutableMapping]] = dict def f(self) -> MutableMapping: return self.x() c = C() print(c.f()) Gives a.py:6: error: Attribute function "x" with type "Ca...
Open Graph Description: from typing import Callable, MutableMapping, ClassVar class C: x: ClassVar[Callable[[], MutableMapping]] = dict def f(self) -> MutableMapping: return self.x() c = C() print(c.f()) Gives a.py:6: err...
X Description: from typing import Callable, MutableMapping, ClassVar class C: x: ClassVar[Callable[[], MutableMapping]] = dict def f(self) -> MutableMapping: return self.x() c = C() print(c.f()) Gives a.py:6: ...
Opengraph URL: https://github.com/python/mypy/issues/11077
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Callable ClassVar is incorrectly treated as a method","articleBody":"```python\r\nfrom typing import Callable, MutableMapping, ClassVar\r\n\r\nclass C:\r\n x: ClassVar[Callable[[], MutableMapping]] = dict\r\n def f(self) -> MutableMapping:\r\n return self.x() \r\n\r\nc = C()\r\nprint(c.f())\r\n```\r\nGives\r\n```\r\na.py:6: error: Attribute function \"x\" with type \"Callable[[], MutableMapping[Any, Any]]\" does not accept self argument\r\n```","author":{"url":"https://github.com/NeilGirdhar","@type":"Person","name":"NeilGirdhar"},"datePublished":"2021-09-09T01:45:19Z","url":"https://github.com/python/mypy/issues/11077"}
| 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:e0ca6d09-648e-7906-0834-e545df57eaf9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B1CE:2C0A92:26139CA:318EC9E:6AFFF7DC |
| html-safe-nonce | cb02dd29023d46dfee0b9322ff7572cd20b9788e5116e4bc5fb15f9d40587265 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMUNFOjJDMEE5MjoyNjEzOUNBOjMxOEVDOUU6NkFGRkY3REMiLCJ2aXNpdG9yX2lkIjoiMzIzODEwNzM0NTI2MzI2MTY2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 512ed2edc93cead623b90f9620acb52b6351388d3b3021b02499fa7937008b6b |
| hovercard-subject-tag | issue:991670268 |
| 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/11077/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e13b77c59d1ebe55eb36e89f979a4474a0f91087a7e8f45265bf2de447fa616e/python/mypy/issues/11077 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e13b77c59d1ebe55eb36e89f979a4474a0f91087a7e8f45265bf2de447fa616e/python/mypy/issues/11077 |
| og:image:alt | from typing import Callable, MutableMapping, ClassVar class C: x: ClassVar[Callable[[], MutableMapping]] = dict def f(self) -> MutableMapping: return self.x() c = C() print(c.f()) Gives a.py:6: err... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | NeilGirdhar |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width