Title: MyPy does not enforce Hashability · Issue #2455 · python/mypy · GitHub
Open Graph Title: MyPy does not enforce Hashability · Issue #2455 · python/mypy
X Title: MyPy does not enforce Hashability · Issue #2455 · python/mypy
Description: For example, the following code is illegal in Python 3 (implementing __eq__ shadows your __hash__ implementation with None in Python 3) class Foo(object): def __init__(self, x): self.x = x def __eq__(self, other): if not isinstance(other...
Open Graph Description: For example, the following code is illegal in Python 3 (implementing __eq__ shadows your __hash__ implementation with None in Python 3) class Foo(object): def __init__(self, x): self.x = x def __eq...
X Description: For example, the following code is illegal in Python 3 (implementing __eq__ shadows your __hash__ implementation with None in Python 3) class Foo(object): def __init__(self, x): self.x = x def __eq...
Opengraph URL: https://github.com/python/mypy/issues/2455
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"MyPy does not enforce Hashability","articleBody":"For example, the following code is illegal in Python 3 (implementing `__eq__` shadows your `__hash__` implementation with `None` in Python 3)\r\n\r\n```python\r\nclass Foo(object):\r\n def __init__(self, x):\r\n self.x = x\r\n def __eq__(self, other):\r\n if not isinstance(other, Foo):\r\n return NotImplemented\r\n return self.x == other.x\r\n\r\nset_of_foo = {Foo(1), Foo(2)}\r\n```\r\n\r\nPoking around the code, AFAICT `mypy` doesn't do any `Hashable` checks. I don't see any other Protocols being checked in `checker.py`. Is there any existing tickets around supporting Protocols in mypy?\r\n","author":{"url":"https://github.com/rowillia","@type":"Person","name":"rowillia"},"datePublished":"2016-11-15T02:48:58Z","url":"https://github.com/python/mypy/issues/2455"}
| 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:59ff3e3c-4775-2ddf-51aa-7df5ccda7b4e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 907A:F5AA9:1D03D70:27480B0:6B000B8D |
| html-safe-nonce | 6a308ad25d64e408383b728541e70eea341357553b05ca5fa6a75eb7d60aca58 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MDdBOkY1QUE5OjFEMDNENzA6Mjc0ODBCMDo2QjAwMEI4RCIsInZpc2l0b3JfaWQiOiI4Mjk2OTY2MjExNTg1OTY5MDM3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 005034a965a85d0a0f714c375243dfcb201c3b90462aac589e7b14d26dbdc739 |
| hovercard-subject-tag | issue:189285845 |
| 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/2455/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6d20acabc4c5d093a6dee846dd9e81d39b75dc96a5c43013a4f058562aca5137/python/mypy/issues/2455 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6d20acabc4c5d093a6dee846dd9e81d39b75dc96a5c43013a4f058562aca5137/python/mypy/issues/2455 |
| og:image:alt | For example, the following code is illegal in Python 3 (implementing __eq__ shadows your __hash__ implementation with None in Python 3) class Foo(object): def __init__(self, x): self.x = x def __eq... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rowillia |
| 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