Title: NamedTuple single line declaration gives error "Too many arguments for NamedTuple() [misc] · Issue #11047 · python/mypy · GitHub
Open Graph Title: NamedTuple single line declaration gives error "Too many arguments for NamedTuple() [misc] · Issue #11047 · python/mypy
X Title: NamedTuple single line declaration gives error "Too many arguments for NamedTuple() [misc] · Issue #11047 · python/mypy
Description: Bug Report typing.NamedTuple one line declaration gives incorrect error To Reproduce # test.py from typing import NamedTuple ExampleClass = NamedTuple('ExampleClass', test_id=str, timestamp=str) mypy --show-error-codes test.py test.py:[l...
Open Graph Description: Bug Report typing.NamedTuple one line declaration gives incorrect error To Reproduce # test.py from typing import NamedTuple ExampleClass = NamedTuple('ExampleClass', test_id=str, timestamp=str) my...
X Description: Bug Report typing.NamedTuple one line declaration gives incorrect error To Reproduce # test.py from typing import NamedTuple ExampleClass = NamedTuple('ExampleClass', test_id=str, timestamp...
Opengraph URL: https://github.com/python/mypy/issues/11047
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"NamedTuple single line declaration gives error \"Too many arguments for NamedTuple() [misc]","articleBody":"**Bug Report**\r\n\r\ntyping.NamedTuple one line declaration gives incorrect error\r\n\r\n**To Reproduce**\r\n\r\n```python\r\n# test.py\r\nfrom typing import NamedTuple\r\n\r\nExampleClass = NamedTuple('ExampleClass', test_id=str, timestamp=str)\r\n```\r\n\r\n```bash\r\nmypy --show-error-codes test.py\r\n\r\ntest.py:[line-no]: error: Too many arguments for NamedTuple() [misc]\r\n```\r\n**Expected Behavior**\r\n\r\nmypy doesn't give this error\r\n\r\ngiven the above syntax is valid python and works fine, I would expect it to not throw an error, like the following old structure declaration does not, which is labeled as \"back-ward compatible usage\" [in the official doc](https://docs.python.org/3/library/typing.html#typing.NamedTuple)\r\n\r\n```python\r\nExampleClass = NamedTuple('ExampleClass', [(test_id, str), (timestamp, str)])\r\n```\r\n\r\n**Actual Behavior**\r\n\r\n```bash\r\nerror: Too many arguments for NamedTuple() [misc]\r\n```\r\n\r\n**Your Environment**\r\n\r\n```\r\nmypy --version\r\nmypy 0.910\r\n\r\npython --version\r\n3.8.10\r\n```","author":{"url":"https://github.com/yesthesoup","@type":"Person","name":"yesthesoup"},"datePublished":"2021-09-02T21:46:30Z","url":"https://github.com/python/mypy/issues/11047"}
| 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:4434130e-c2e5-0caf-726a-2532bf8d184c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BC48:3AC034:75CF7:A2058:6B001B52 |
| html-safe-nonce | 47965b13da682f4b6af8c683aa1464b24b84fbe8749658ee9f7ebf93a0405126 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzQ4OjNBQzAzNDo3NUNGNzpBMjA1ODo2QjAwMUI1MiIsInZpc2l0b3JfaWQiOiI4NDA4NjU4NzM0NDkzOTk3OTA2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 256ae5889cbb124f0edda8737e228cf1a84017cd779d47a56c84ef92addf63e9 |
| hovercard-subject-tag | issue:987192896 |
| 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/11047/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6d8bdae42c3b1be445c110f2ce5eb956584936aa568ed2f22bde12ab012b4c6b/python/mypy/issues/11047 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6d8bdae42c3b1be445c110f2ce5eb956584936aa568ed2f22bde12ab012b4c6b/python/mypy/issues/11047 |
| og:image:alt | Bug Report typing.NamedTuple one line declaration gives incorrect error To Reproduce # test.py from typing import NamedTuple ExampleClass = NamedTuple('ExampleClass', test_id=str, timestamp=str) my... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yesthesoup |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width