Title: Enum of a NamedTuple-derived type leads to incompatible type error · Issue #1745 · python/mypy · GitHub
Open Graph Title: Enum of a NamedTuple-derived type leads to incompatible type error · Issue #1745 · python/mypy
X Title: Enum of a NamedTuple-derived type leads to incompatible type error · Issue #1745 · python/mypy
Description: This code: from typing import NamedTuple from enum import Enum Foo = NamedTuple('Foo', [('bar', int)]) class MyEnum(Foo, Enum): CONSTANT = Foo(bar=1) def f(x): # type: (MyEnum) -> None pass f(MyEnum.CONSTANT) leads to: error: Argument 1 ...
Open Graph Description: This code: from typing import NamedTuple from enum import Enum Foo = NamedTuple('Foo', [('bar', int)]) class MyEnum(Foo, Enum): CONSTANT = Foo(bar=1) def f(x): # type: (MyEnum) -> None pass f(MyEnu...
X Description: This code: from typing import NamedTuple from enum import Enum Foo = NamedTuple('Foo', [('bar', int)]) class MyEnum(Foo, Enum): CONSTANT = Foo(bar=1) def f(x): # type: (MyEnum) ->...
Opengraph URL: https://github.com/python/mypy/issues/1745
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Enum of a NamedTuple-derived type leads to incompatible type error","articleBody":"This code:\n\n``` python\nfrom typing import NamedTuple\nfrom enum import Enum\n\nFoo = NamedTuple('Foo', [('bar', int)])\n\nclass MyEnum(Foo, Enum):\n CONSTANT = Foo(bar=1)\n\ndef f(x):\n # type: (MyEnum) -> None\n pass\n\nf(MyEnum.CONSTANT)\n```\n\nleads to:\n\n```\nerror: Argument 1 to \"f\" has incompatible type \"test.MyEnum\"; expected \"MyEnum\"\n```\n","author":{"url":"https://github.com/AlexOnAPeak","@type":"Person","name":"AlexOnAPeak"},"datePublished":"2016-06-25T00:09:29Z","url":"https://github.com/python/mypy/issues/1745"}
| 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:c1fee1ab-65e2-78a0-57ac-238d2b8321be |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C2EC:2A087:F6EB4E:14CAB7C:6B005DD9 |
| html-safe-nonce | da45d6b380cc64b02bc0978a5f68bbaed2e46a6c986feb7d1f15106a2bdb24ed |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMkVDOjJBMDg3OkY2RUI0RToxNENBQjdDOjZCMDA1REQ5IiwidmlzaXRvcl9pZCI6Ijc5OTUxODk3NDQ4MDU4OTU2NDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a2c3f4da8bbdb1d9938262761f4a97ba4a96d8aff3c410b10e997470000f2119 |
| hovercard-subject-tag | issue:162252011 |
| 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/1745/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f543e7008306e8edc8180036b79402a08391627eaf10f6a29a7334a3af2b2e66/python/mypy/issues/1745 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f543e7008306e8edc8180036b79402a08391627eaf10f6a29a7334a3af2b2e66/python/mypy/issues/1745 |
| og:image:alt | This code: from typing import NamedTuple from enum import Enum Foo = NamedTuple('Foo', [('bar', int)]) class MyEnum(Foo, Enum): CONSTANT = Foo(bar=1) def f(x): # type: (MyEnum) -> None pass f(MyEnu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AlexOnAPeak |
| hostname | github.com |
| expected-hostname | github.com |
| None | 29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73 |
| 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 | eacd927ba6112e3b01ba99c762bd699a4a4f5df7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width