Title: Changed strict-equality behavior with dict/Mapping · Issue #16340 · python/mypy · GitHub
Open Graph Title: Changed strict-equality behavior with dict/Mapping · Issue #16340 · python/mypy
X Title: Changed strict-equality behavior with dict/Mapping · Issue #16340 · python/mypy
Description: When using mypy 1.6, this example produces no errors: # mypy: strict-equality from typing import Mapping def f(x: dict[str, int | None], y: dict[str, str | None]) -> bool: return x == y def g(x: Mapping[str, int], y: str) -> bool: return...
Open Graph Description: When using mypy 1.6, this example produces no errors: # mypy: strict-equality from typing import Mapping def f(x: dict[str, int | None], y: dict[str, str | None]) -> bool: return x == y def g(x: Ma...
X Description: When using mypy 1.6, this example produces no errors: # mypy: strict-equality from typing import Mapping def f(x: dict[str, int | None], y: dict[str, str | None]) -> bool: return x == y def g(x:...
Opengraph URL: https://github.com/python/mypy/issues/16340
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Changed strict-equality behavior with dict/Mapping","articleBody":"When using mypy 1.6, this example produces no errors:\r\n```py\r\n# mypy: strict-equality\r\n\r\nfrom typing import Mapping\r\n\r\ndef f(x: dict[str, int | None], y: dict[str, str | None]) -> bool:\r\n return x == y\r\n\r\ndef g(x: Mapping[str, int], y: str) -> bool:\r\n return x == y\r\n```\r\nHowever, after #16237, it started generating these errors:\r\n```\r\nt.py:6: error: Non-overlapping equality check (left operand type: \"dict[str, int | None]\", right operand type: \"dict[str, str | None]\") [comparison-overlap]\r\nt.py:9: error: Non-overlapping equality check (left operand type: \"Mapping[str, int]\", right operand type: \"str\") [comparison-overlap]\r\n```\r\nI'm not sure if the new behavior is better or not, but I suspect that the change in behavior may have been an unintended consequence of #16237, so it seems worth investigating what is going on.\r\n\r\ncc @ilevkivskyi ","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2023-10-27T11:02:01Z","url":"https://github.com/python/mypy/issues/16340"}
| 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:e4af4920-ab89-ff52-5941-475426bfe6d4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CACC:2E6021:251E01D:3079BF4:6AFFF7E8 |
| html-safe-nonce | ad03ce33e3dac32e48aa7db4be4c67e00224438ef4825c3c3e5904f661d3098f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQUNDOjJFNjAyMToyNTFFMDFEOjMwNzlCRjQ6NkFGRkY3RTgiLCJ2aXNpdG9yX2lkIjoiNDkzMjcwNjcwNjQ0NzY2MTAzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4083023424417c31b7a2c2257e9475656729702f5413356e331141e44245394d |
| hovercard-subject-tag | issue:1965283065 |
| 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/16340/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7e6c3472b30dfb16aac0679a4d9662c64c77a85c447539f9c416836a96e84d24/python/mypy/issues/16340 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7e6c3472b30dfb16aac0679a4d9662c64c77a85c447539f9c416836a96e84d24/python/mypy/issues/16340 |
| og:image:alt | When using mypy 1.6, this example produces no errors: # mypy: strict-equality from typing import Mapping def f(x: dict[str, int | None], y: dict[str, str | None]) -> bool: return x == y def g(x: Ma... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JukkaL |
| 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