Title: Mypy doesn't catch unhashable literals in hashdependant literals. · Issue #8150 · python/mypy · GitHub
Open Graph Title: Mypy doesn't catch unhashable literals in hashdependant literals. · Issue #8150 · python/mypy
X Title: Mypy doesn't catch unhashable literals in hashdependant literals. · Issue #8150 · python/mypy
Description: context on the python-dev mailing list As per Guido and Nicks suggestions I am opening this issue here :D """foo bar.""" from typing import Set, Dict SOME = {{0}} print(SOME) def green_eggs() -> Set[Set[int]]: """foo.""" return {{1}} def...
Open Graph Description: context on the python-dev mailing list As per Guido and Nicks suggestions I am opening this issue here :D """foo bar.""" from typing import Set, Dict SOME = {{0}} print(SOME) def green_eggs() -> Se...
X Description: context on the python-dev mailing list As per Guido and Nicks suggestions I am opening this issue here :D """foo bar.""" from typing import Set, Dict SOME = {{0}} prin...
Opengraph URL: https://github.com/python/mypy/issues/8150
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Mypy doesn't catch unhashable literals in hashdependant literals.","articleBody":"[context on the python-dev mailing list](https://mail.python.org/archives/list/python-dev@python.org/thread/IUOIEOCI22N3G67HX5BOKBS7Z26KC4FX/)\r\n\r\nAs per Guido and Nicks suggestions I am opening this issue here :D\r\n\r\n```py\r\n\"\"\"foo bar.\"\"\"\r\n\r\nfrom typing import Set, Dict\r\n\r\nSOME = {{0}}\r\nprint(SOME)\r\n\r\n\r\ndef green_eggs() -> Set[Set[int]]:\r\n \"\"\"foo.\"\"\"\r\n return {{1}}\r\n\r\n\r\ndef and_ham() -> Dict[Set[int], int]:\r\n \"\"\"bar.\"\"\"\r\n return {{1}: 0}\r\n```\r\n\r\nMypy reports this as fine with no errors.\r\nIt should detect and throw when encountering `{{1}: 0}` or `Dict[Set[int], int]` or `{{1}}` or `{[1]}` since these are literals whose types are not hashable therefore they may not be used in types that require members be hashable i.e. `Dict` or `Set`.\r\n\r\nI'm using mypy `0.750` and ```\r\nPython 3.8.0 (default, Oct 23 2019, 18:51:26) \r\n[GCC 9.2.0] on linux```\r\n\r\nIf needed I'm happy to attempt to PR this myself :)","author":{"url":"https://github.com/mental32","@type":"Person","name":"mental32"},"datePublished":"2019-12-15T15:31:57Z","url":"https://github.com/python/mypy/issues/8150"}
| 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:c02e522a-ed55-c37a-111a-3571bdae6100 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BFD6:137B3:1A67119:22D7374:6B002F5C |
| html-safe-nonce | 365d5dd073da334c106a9d440522ab9a7ca061e0bb1e5e92d196a1cd195517c8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRkQ2OjEzN0IzOjFBNjcxMTk6MjJENzM3NDo2QjAwMkY1QyIsInZpc2l0b3JfaWQiOiI5MTQ3NDM5MzE3OTM1ODM5NjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8e1436d94ed6b382a51a7f2ba4201dcdf640b661ae83f7e103f2b62467ca05b1 |
| hovercard-subject-tag | issue:538066713 |
| 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/8150/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4b687fc1d8ab29f40a488ffeae2aadd007d780fc1e46d5da224bb7d63f76fd97/python/mypy/issues/8150 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4b687fc1d8ab29f40a488ffeae2aadd007d780fc1e46d5da224bb7d63f76fd97/python/mypy/issues/8150 |
| og:image:alt | context on the python-dev mailing list As per Guido and Nicks suggestions I am opening this issue here :D """foo bar.""" from typing import Set, Dict SOME = {{0}} print(SOME) def green_eggs() -> Se... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mental32 |
| 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