Title: Self being a typing._SpecialForm prevents a case from PEP 673 · Issue #26 · python/typing_extensions · GitHub
Open Graph Title: Self being a typing._SpecialForm prevents a case from PEP 673 · Issue #26 · python/typing_extensions
X Title: Self being a typing._SpecialForm prevents a case from PEP 673 · Issue #26 · python/typing_extensions
Description: Among the valid locations for Self in PEP 673 we find: TupleSelf = Tuple[Self, Self] class Alias: def return_tuple(self) -> TupleSelf: return (self, self) But typing._type_check regards typing._SpecialForm instances invalid type argument...
Open Graph Description: Among the valid locations for Self in PEP 673 we find: TupleSelf = Tuple[Self, Self] class Alias: def return_tuple(self) -> TupleSelf: return (self, self) But typing._type_check regards typing._Spe...
X Description: Among the valid locations for Self in PEP 673 we find: TupleSelf = Tuple[Self, Self] class Alias: def return_tuple(self) -> TupleSelf: return (self, self) But typing._type_check regards typing._...
Opengraph URL: https://github.com/python/typing_extensions/issues/26
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Self being a typing._SpecialForm prevents a case from PEP 673","articleBody":"Among the [valid locations for Self](https://www.python.org/dev/peps/pep-0673/#valid-locations-for-self) in PEP 673 we find:\r\n```python\r\nTupleSelf = Tuple[Self, Self]\r\nclass Alias:\r\n def return_tuple(self) -> TupleSelf:\r\n return (self, self)\r\n```\r\n\r\nBut `typing._type_check` regards `typing._SpecialForm` instances invalid type arguments\r\nhttps://github.com/python/cpython/blob/e0f8a3e9b96bbc2597f61be96993ef0c768a19fe/Lib/typing.py#L179\r\n\r\nSo this use will result in a\r\n\r\n TypeError: Plain typing_extensions.Self is not valid as type argument\r\n\r\nThis also affects uses in linked lists and recursive dataclasses lke \r\n```python\r\n@dataclasses.dataclass\r\nclass MenuItem:\r\n url: str\r\n title: str\r\n description: str = \"\"\r\n items: typing.List[typing_extensions.Self] = dataclasses.field(default_factory=list)\r\n```","author":{"url":"https://github.com/CharString","@type":"Person","name":"CharString"},"datePublished":"2021-11-25T19:10:17Z","url":"https://github.com/python/typing_extensions/issues/26"}
| 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:ee6631c7-add3-e41a-d81e-7a3332a11d15 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B83E:609A0:27CC86F:33B2795:6AFFF7B6 |
| html-safe-nonce | 19ef923e673f228f3be7ebab0af38d6c58edd18cb09183be2d372db74de755b7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODNFOjYwOUEwOjI3Q0M4NkY6MzNCMjc5NTo2QUZGRjdCNiIsInZpc2l0b3JfaWQiOiI4MzEwNjQyMTA5MDEwOTMzNjg2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6a9b89bb9aef860797930b57b5100c202096b5049d34016352e930da1dfe1601 |
| hovercard-subject-tag | issue:1241867178 |
| 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_extensions/26/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c69ed8677716d53cd5679a958f50047feb70df23f9f754653367b5e960f082dd/python/typing_extensions/issues/26 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c69ed8677716d53cd5679a958f50047feb70df23f9f754653367b5e960f082dd/python/typing_extensions/issues/26 |
| og:image:alt | Among the valid locations for Self in PEP 673 we find: TupleSelf = Tuple[Self, Self] class Alias: def return_tuple(self) -> TupleSelf: return (self, self) But typing._type_check regards typing._Spe... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | CharString |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typing_extensions git https://github.com/python/typing_extensions.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 494077289 |
| octolytics-dimension-repository_nwo | python/typing_extensions |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 494077289 |
| octolytics-dimension-repository_network_root_nwo | python/typing_extensions |
| 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