Title: Add typing.get_orig_bases and typing.get_orig_class · Issue #101688 · python/cpython · GitHub
Open Graph Title: Add typing.get_orig_bases and typing.get_orig_class · Issue #101688 · python/cpython
X Title: Add typing.get_orig_bases and typing.get_orig_class · Issue #101688 · python/cpython
Description: Feature or enhancement typing has had type.__orig_bases__ and type.__orig_class__ for quite some time now, there is no stable API to access these attributes. Pitch I would like to propose adding typing.get_orig_bases as something like @o...
Open Graph Description: Feature or enhancement typing has had type.__orig_bases__ and type.__orig_class__ for quite some time now, there is no stable API to access these attributes. Pitch I would like to propose adding ty...
X Description: Feature or enhancement typing has had type.__orig_bases__ and type.__orig_class__ for quite some time now, there is no stable API to access these attributes. Pitch I would like to propose adding ty...
Opengraph URL: https://github.com/python/cpython/issues/101688
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add typing.get_orig_bases and typing.get_orig_class","articleBody":"# Feature or enhancement\r\n\r\ntyping has had `type.__orig_bases__` and `type.__orig_class__` for quite some time now, there is no stable API to access these attributes.\r\n\r\n# Pitch\r\n\r\nI would like to propose adding `typing.get_orig_bases` as something like\r\n```py\r\n@overload\r\ndef get_orig_bases(cls: type[object]) -\u003e tuple[type[Any], ...] | None: ...\r\n@overload\r\ndef get_orig_bases(cls: Any) -\u003e None: ...\r\ndef get_orig_bases(cls: Any) -\u003e tuple[type[Any], ...] | None:\r\n\treturn getattr(cls, \"__orig_bases__\", None)\r\n```\r\nand `typing.get_orig_class`\r\n```py\r\n@overload\r\ndef get_orig_class(cls: type[object]) -\u003e GenericAlias | None: ...\r\n@overload\r\ndef get_orig_class(cls: Any) -\u003e None: ...\r\ndef get_orig_class(cls: Any) -\u003e GenericAlias | None:\r\n\treturn getattr(cls, \"__orig_class__\", None)\r\n```\r\n(side note, it might be possible to fully type `get_orig_class` it `types.GenericAlias` was generic over the `__origin__` and `__args__` i.e. `Foo[int] == GenericAlias[Foo, int]`)\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-101827\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/Gobot1234","@type":"Person","name":"Gobot1234"},"datePublished":"2023-02-08T10:59:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/101688/cpython/issues/101688"}
| 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:602c3b22-2f4c-d334-8f02-dbf49ef7f2f0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CFEA:4D95E:23723F:321BD4:696A064D |
| html-safe-nonce | 25d6edc6064ed26558709c4ad9f0d09283731236df0bbafd19c7ac4c123731a2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRkVBOjREOTVFOjIzNzIzRjozMjFCRDQ6Njk2QTA2NEQiLCJ2aXNpdG9yX2lkIjoiNzI1MDYxODMyODkyMzM3NTE4MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c8830ebbb1b98e0956b2b06ae43dcdde3a698783f0039cee31760a1a46c61acf |
| hovercard-subject-tag | issue:1575910383 |
| 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/cpython/101688/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b69fba4a127d6daf0e5faaad0d6faaf8439f644d7623e3ec93d1b23160977eea/python/cpython/issues/101688 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b69fba4a127d6daf0e5faaad0d6faaf8439f644d7623e3ec93d1b23160977eea/python/cpython/issues/101688 |
| og:image:alt | Feature or enhancement typing has had type.__orig_bases__ and type.__orig_class__ for quite some time now, there is no stable API to access these attributes. Pitch I would like to propose adding ty... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Gobot1234 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 578c119ff0247c8b2f2491fbf4fc0395cdf909d4df66598cebdc96ddfc4418dc |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | 671c2f67171dbced24284331f3133a613d08c366 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width