Title: NoReturn and Never are underspecified in the spec · Issue #1458 · python/typing · GitHub
Open Graph Title: NoReturn and Never are underspecified in the spec · Issue #1458 · python/typing
X Title: NoReturn and Never are underspecified in the spec · Issue #1458 · python/typing
Description: Never was added without a PEP as a way to directly indicate that something is uninhabited in 3.11 This brings up something from CarliJoy/intersection_examples#5 (comment) where we now have a way to express what appears to be an LSP viola...
Open Graph Description: Never was added without a PEP as a way to directly indicate that something is uninhabited in 3.11 This brings up something from CarliJoy/intersection_examples#5 (comment) where we now have a way to...
X Description: Never was added without a PEP as a way to directly indicate that something is uninhabited in 3.11 This brings up something from CarliJoy/intersection_examples#5 (comment) where we now have a way to...
Opengraph URL: https://github.com/python/typing/issues/1458
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"NoReturn and Never are underspecified in the spec","articleBody":"Never was added without a PEP as a way to directly indicate that something is uninhabited in 3.11\r\n\r\nThis brings up something from \u003chttps://github.com/CarliJoy/intersection_examples/issues/5#issuecomment-1699490563> where we now have a way to express what appears to be an LSP violation that type checks (incorrectly) properly via structural subtyping by mishandling Never as a subtype of other types. Never is not a subtype of all other types. As the bottom type, it is uninhabited and does not follow subtyping rules.\r\n\r\n```py\r\nfrom typing import Never\r\n\r\nclass A:\r\n def foo(self, x: int) -> None: ...\r\n \r\nclass B(A):\r\n foo: Never # __getattr__(B, \"foo\") -> raise NotImplementedError\r\n \r\nx: A = B() # type checks \r\nreveal_type(B.foo)\r\n```\r\n\r\nhttps://mypy-play.net/?mypy=latest&python=3.11&flags=strict&gist=a4279b36d82c1a28d7b17be9a4bbcbdf\r\n\r\nI believe under LSP, B is no longer a safe drop-in replacement for A. It's important to note that ongoing work to formalize the type system, including Never does not treat Never as a subtype of all other types, see the ongoing work here: http://bit.ly/python-subtyping\r\n\r\n\r\n\r\n","author":{"url":"https://github.com/DiscordLiz","@type":"Person","name":"DiscordLiz"},"datePublished":"2023-08-30T17:15:57Z","url":"https://github.com/python/typing/issues/1458"}
| 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:02bc9326-abd1-22b6-1425-b5771f5e1ccb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EDC8:29A20E:5EF4ED:80747C:6AFF8889 |
| html-safe-nonce | 2b2c3eec7ae960ab3db09030a05e8181f217953abdaf31e9d9ce09d0ea7f26bb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFREM4OjI5QTIwRTo1RUY0RUQ6ODA3NDdDOjZBRkY4ODg5IiwidmlzaXRvcl9pZCI6Ijc1NzEwNzUzMDkzMDczOTgyODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f8fc4196e4df298e4ce8ba086de60dc8336f81e2e98ae4050ecb553c8302884a |
| hovercard-subject-tag | issue:1874251869 |
| 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/typing/1458/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f4d41c8f558c873087a66d17e31b6870181aa60001158808444b893a2a560906/python/typing/issues/1458 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f4d41c8f558c873087a66d17e31b6870181aa60001158808444b893a2a560906/python/typing/issues/1458 |
| og:image:alt | Never was added without a PEP as a way to directly indicate that something is uninhabited in 3.11 This brings up something from CarliJoy/intersection_examples#5 (comment) where we now have a way to... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DiscordLiz |
| hostname | github.com |
| expected-hostname | github.com |
| None | 587ad99a3e443b2e1cb0d3df059ec49ab54389861f13310766dfdeb615fed90d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typing git https://github.com/python/typing.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 24604008 |
| octolytics-dimension-repository_nwo | python/typing |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24604008 |
| octolytics-dimension-repository_network_root_nwo | python/typing |
| 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 | 5bb0fb68d64881d1344f5863d809515d496801e5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width