Title: self.__class__ is Any, unless I annotate __init__, in which case it is "type" · Issue #4065 · python/mypy · GitHub
Open Graph Title: self.__class__ is Any, unless I annotate __init__, in which case it is "type" · Issue #4065 · python/mypy
X Title: self.__class__ is Any, unless I annotate __init__, in which case it is "type" · Issue #4065 · python/mypy
Description: Wouldn't it be better if the type of self.class was the current class? `class Class(object): attr = None def __init__(self): # type: () -> None reveal_type(self.__class__) print(self.__class__.attr) ` This way, the revealed type is: Reve...
Open Graph Description: Wouldn't it be better if the type of self.class was the current class? `class Class(object): attr = None def __init__(self): # type: () -> None reveal_type(self.__class__) print(self.__class__.attr...
X Description: Wouldn't it be better if the type of self.class was the current class? `class Class(object): attr = None def __init__(self): # type: () -> None reveal_type(self.__class__) print(self.__class...
Opengraph URL: https://github.com/python/mypy/issues/4065
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"self.__class__ is Any, unless I annotate __init__, in which case it is \"type\"","articleBody":"Wouldn't it be better if the type of self.__class__ was the current class?\r\n\r\n`class Class(object):\r\n attr = None\r\n\r\n def __init__(self):\r\n # type: () -> None\r\n reveal_type(self.__class__)\r\n print(self.__class__.attr)\r\n`\r\n\r\nThis way, the revealed type is:\r\nRevealed type is 'builtins.type'\r\n\r\nIf I remove the # type annotation, the revealed type is:\r\nRevealed type is 'Any'\r\n","author":{"url":"https://github.com/douglas-treadwell","@type":"Person","name":"douglas-treadwell"},"datePublished":"2017-10-05T22:13:33Z","url":"https://github.com/python/mypy/issues/4065"}
| 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:be8ff7fa-7f0c-6a3f-81d5-4895c2fe0029 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AF3A:5875E:1C7346F:2674588:6B0007E4 |
| html-safe-nonce | 2427e5ca078e09675015f6e41a85d53378bd52e2073406cf0c4f6ea760ca71a7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRjNBOjU4NzVFOjFDNzM0NkY6MjY3NDU4ODo2QjAwMDdFNCIsInZpc2l0b3JfaWQiOiI0OTIwNDU4MTk0MTU4ODgwNzQwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c147eb37de95523790842b2221a0b980eaf9a3fee711ff9552958918b85bd333 |
| hovercard-subject-tag | issue:263282898 |
| 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/4065/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bdde81ff6305c7adee8ba9baa4808bbb0500887ced733c1330c15903c2702dec/python/mypy/issues/4065 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bdde81ff6305c7adee8ba9baa4808bbb0500887ced733c1330c15903c2702dec/python/mypy/issues/4065 |
| og:image:alt | Wouldn't it be better if the type of self.class was the current class? `class Class(object): attr = None def __init__(self): # type: () -> None reveal_type(self.__class__) print(self.__class__.attr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | douglas-treadwell |
| 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